RTC Forums
April 25, 2024, 01:08:18 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   Home   Help Login Register  
Pages: [1]
  Print  
Author Topic: ADO Connection Object  (Read 3899 times)
zsleo
RTC Expired
*
Posts: 80


« on: December 08, 2015, 02:19:26 AM »

Has anyone passed an ADO Connection Object as an RTC Param.

On the RTC client I use:

  with rtclntmdlReport do
  begin
    StartCalls;
    try
      with Data.NewFunction('RunReport') do
      begin
        Value['Connection'] := UserSession.conMSQLSite.ConnectionObject;
      end;
      Call(rtcrsltReport);
    finally
      Post;
    end;
  end;

The app compiles without error.


On the RTC Server I use:

  conMSQL.ConnectionObject := Param.asObject['Connection'];

I get a compile error:
[DCC Error] AppServer_Module.pas(135): E2010 Incompatible types: '_Connection' and 'TRtcValueObject'

In both client and server the ADO component I use is a TADOConnection

All suggestions and help will be appreciated.

TIA
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #1 on: December 08, 2015, 02:17:37 PM »

You can not pass an Object as a parameter to a remote function call and expect the same Object to be available on the remote side. There is no compile error on the Client side only because the Value property is declared as Variant to simplify assignment operations, but there is no mapping between an arbitrary TObject to a RTC Value. You should get an exception at runtime on the Client-side, though.

PS. If you are looking for examples on accessing a Database remotely using the RTC SDK, check Projects contained in the SDKDemos_VCL_DBA and SDKDemos_FMX_DBA Project Groups.

Best Regards,
Danijel Tkalcec
Logged
zsleo
RTC Expired
*
Posts: 80


« Reply #2 on: December 08, 2015, 11:42:26 PM »

Danijel

Thanks for the reply.

I did look at the examples prior to posting the request.

I tried the method in my post after I experienced connection problems.

In my original implementation I posted the TADOConnection details as RTC Params and established a new DB connection for each session. In every instance the DB connection is established successfully.

The problem I have with this is that the first time I post the request the TADOQuery(s) linked to the TADOConnection almost always report DB not connected.  If I re-post the request then the TADOQuery(s) always work correctly.

DB Pooling is unlikely to be an option because each RTC session can request TADOConnection connect to any one of many (potentially more than 50) databases.

I am still working to find a solution.

Best Regards
Logged
D.Tkalcec (RTC)
Administrator
*****
Posts: 1881


« Reply #3 on: December 09, 2015, 10:02:45 AM »

Good luck finding the best solution.

Best Regards,
Danijel Tkalcec
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!
Page created in 0.024 seconds with 16 queries.