Datasnap + Remobjects SDK

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
hmelihkara
Posts: 21
Joined: Fri 09 Nov 2007 23:29

Datasnap + Remobjects SDK

Post by hmelihkara » Wed 18 Jan 2012 21:47

Hi,
I've a basic datasnap server / client with Remobjects Datasnap module.
Everything seems working normal till try to update some data.
I edit data from client and post it. After that I need to applyupdates(-1); to apply updates to server but I got:
An exception was raised on the server: One of the connections in the transaction is not active.

When I change SDAC(v 6.1.4) components with ADO ones. Update happens and works without any problems.

Is there any workaround about this. I also check the midas demo for any special commands, etc... but nothing.

on Datasnap module I simply have:
TMSConnection
TMSQuery
TDatasetProvider

Thanks...

AndreyZ

Post by AndreyZ » Thu 19 Jan 2012 10:03

Hello,

Such problem occurs on working with transaction used by several connections, some of which are not active. Please check if the problem persists when you are not using RemObjects components.
Also, you can try creating a small sample to demonstrate the problem and send it to andreyz*devart*com.

hmelihkara
Posts: 21
Joined: Fri 09 Nov 2007 23:29

Post by hmelihkara » Tue 24 Jan 2012 23:19

Test case sent to your mail.

Thanks...

AndreyZ

Post by AndreyZ » Wed 25 Jan 2012 10:44

I have investigated your sample. The point is that the TROClassFactory class destroys TRODataSnapModule after roundtrip to the server is finished, and creates it again when client application sends data to the server. In this case, the TMSConnection component is inactive (because it has just been created ), and there is an attempt to start a transaction using this inactive TMSConnection component. This causes the "One of the connections in the transaction is not active" error. To solve the problem, you should use another factory class that doesn't recreate instances for each roundtrip. For more information, please consult with RemObjects developers.

hmelihkara
Posts: 21
Joined: Fri 09 Nov 2007 23:29

Post by hmelihkara » Wed 25 Jan 2012 10:57

Thanks Andrey,
I've already had opened case with the issue:
http://connect.remobjects.com/discussio ... e-datasnap

Thanks for your helps.

PaulT2
Posts: 29
Joined: Wed 15 Aug 2007 19:31

Re: Datasnap + Remobjects SDK

Post by PaulT2 » Fri 11 Jan 2013 11:30

I know it's 12 months later Andrey, but your answer also directly helped me understand the same error.

We're also using Remobjects, but already using a TROPerClientClassFactory. The problem was basically the same though. The TROPerClientClassFactory was being destoryed on the server, the client later made a call, creating a new one. The first call made on the new class factory instance was the .StartTransaction on a non active TMSConnection.

Our underlying problem is one of not being stateless, which is an architectual issue going back over 10 years now...

Paul.

AndreyZ

Re: Datasnap + Remobjects SDK

Post by AndreyZ » Fri 11 Jan 2013 13:16

I am glad that my answer helped you.

wishmaster
Posts: 8
Joined: Sat 26 Apr 2014 19:00

Re: Datasnap + Remobjects SDK

Post by wishmaster » Sat 26 Apr 2014 19:08

And I know it's 10 months later but...
I'm having problems with RO-SDK + Datasnap.
I've simple query like "SELECT * FROM SOMETABLE" on the server side.
When I change something on the client side and applyupdates. It seems like changes are applied but when I close the form / application and re-open it. Data still unchanged standing there. I try many things but can't make it work. Also I havent got any problems with TROClassFactories it's set to not close till no transaction happens for 30 minutes.

So do I have to write some special update, delete, insert queries? Because when I change components with ADO they works...

Thanks

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Datasnap + Remobjects SDK

Post by azyk » Tue 29 Apr 2014 14:11

Hello,

We couldn't reproduce the problem. Please send us a complete small test project to reproduce the problem.

wishmaster
Posts: 8
Joined: Sat 26 Apr 2014 19:00

Re: Datasnap + Remobjects SDK

Post by wishmaster » Sun 04 May 2014 15:10

Hi,I've found the cause but can't find a proper solution.
When I wrote to the server query:

Code: Select all

SELECT * FROM tblCUSTOMER WHERE CustomerGroup='TEST'
I can edit records from client side and when applied everything is perfect.

But when I wrote to the server query:

Code: Select all

SELECT *, Available=Balance+Credit FROM tblCUSTOMER WHERE CustomerGroup='TEST'
Changes are not reflected to the database.

Thanks


Edit: Filling the SQLUpdate simply solve the problem.

azyk
Devart Team
Posts: 1057
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Datasnap + Remobjects SDK

Post by azyk » Mon 05 May 2014 14:27

Hello,

To solve the problem, you can set the TMSQuery.Options.SetFieldsReadOnly property to True - then ReadOnly property will be set to True for all the fields, that are absent in UpdatingTable. More details about SetFieldsReadOnly can be found at http://www.devart.com/sdac/docs/index.h ... adonly.htm

Post Reply