RTC Forums

Subscription => Support => Topic started by: zsleo on December 08, 2015, 02:19:26 AM



Title: ADO Connection Object
Post by: zsleo 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


Title: Re: ADO Connection Object
Post by: D.Tkalcec (RTC) 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


Title: Re: ADO Connection Object
Post by: zsleo 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


Title: Re: ADO Connection Object
Post by: D.Tkalcec (RTC) on December 09, 2015, 10:02:45 AM
Good luck finding the best solution.

Best Regards,
Danijel Tkalcec