Transaction started from a Delphi package

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
wdwhitaker123456789
Posts: 5
Joined: Tue 01 Apr 2014 23:19

Transaction started from a Delphi package

Post by wdwhitaker123456789 » Tue 01 Apr 2014 23:24

My main application has a datamodule containing a TSQLConnection component. When I call a package from this application and try to create a transaction (StartTransaction(TD)) I receive an Access Violation. I am able to open a TSQLQuery pointing to that same TSQLConnection, but not start a transaction. Does anyone know the proper procedure so I don't have to create a TSQLConnection inside all packages that I'm calling from the main application?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: Transaction started from a Delphi package

Post by AlexP » Wed 02 Apr 2014 13:04

Hello,

We cannot reproduce the problem. Please send a small project (both application and package) reproducing the problem to alexp*devart*com

wdwhitaker123456789
Posts: 5
Joined: Tue 01 Apr 2014 23:19

Re: Transaction started from a Delphi package

Post by wdwhitaker123456789 » Wed 07 May 2014 18:28

I sent sample code last month but have not heard anything back. Did you receive that and if not, what is the best way to get this to you?

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

Re: Transaction started from a Delphi package

Post by azyk » Wed 21 May 2014 13:49

Hello,

We investigated the code sample you have provided - and reproduced the problem:
In the line

Code: Select all

dmDB.sqlDB.starttransaction(TD);
the reason for Access Violation is dmDB = nil. Make sure dmDB is initialized before it is used.

wdwhitaker123456789
Posts: 5
Joined: Tue 01 Apr 2014 23:19

Re: Transaction started from a Delphi package

Post by wdwhitaker123456789 » Wed 21 May 2014 14:11

dmDB is created initially when the main application form is opened. If I have already created dmDB (as part of the opening of the application), how do I pass that to the package? I can't recreate it.

I've been testing and I've noticed that when the package is loaded dynamically, the error occurs. If the package is loaded statically, then no error occurs. I'd prefer to load the package dynamically.

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

Re: Transaction started from a Delphi package

Post by azyk » Thu 22 May 2014 14:29

Hello,

You can pass the link to the object to dynamic library in various ways, for example, via a procedure. This doesn't apply to dbExpress driver for SQL Server, so you can learn more about this from the Embarcadero documentation.

wdwhitaker123456789
Posts: 5
Joined: Tue 01 Apr 2014 23:19

Re: Transaction started from a Delphi package

Post by wdwhitaker123456789 » Thu 22 May 2014 16:04

That's the problem I have is finding that documentation. What I have found on Embarcadero doesn't seem to answer this specific issue. If you have a link that points to what you are suggesting, it would be appreciated. I have tried many different methods and haven't found the answer to this specific question. Can you post a link or method others have used to deal with this issue?

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

Re: Transaction started from a Delphi package

Post by azyk » Fri 23 May 2014 14:19

Hi,

We have modified your project, namely: passed dmDB via a parameter in the procedure called from bpl in the application.

We have sent a letter with an attachment to your email, including the project with the above corrections.

Post Reply