Board index » delphi » Database connection across DLL's

Database connection across DLL's

Hi All,

One of our programmer is having trouble getting a database connection
to say live when calling a DLL.  When the DLL is loaded that contains a
dataware component he is forced to login to the Database again.

Can anyone help with this problem.  We are using Delphi 1.02 client/server
version.

TIA.

 

Re:Database connection across DLL's


Hard to tell for sure without seeing the code, but lets try...
One of the possible causes would be the use of implicit TDatabase
components. That is one in the program, and another in the DLL.
When you open tables or queries, they in fact cooperate with TDatabase
which by default Delphi creates for you. That is the TDatabase that prompts
you to login. If your DLL creates tables/queries, they in turn create a new
instance of the TDatabase - thus your second login prompt (I don't suppose
that the original connection breaks at this point, does it?).
If this scenario seems likely, I would suggest passing the database
component to the DLL and use the same one as the main application.

HTH
Peter

Paul Harrington <pa...@mpx.com.au> wrote in article
<54klc9$...@inferno.mpx.com.au>...

Quote
> Hi All,

> One of our programmer is having trouble getting a database connection
> to say live when calling a DLL.  When the DLL is loaded that contains a
> dataware component he is forced to login to the Database again.

> Can anyone help with this problem.  We are using Delphi 1.02
client/server
> version.

> TIA.

Re:Database connection across DLL's


In article <54klc9$...@inferno.mpx.com.au>, Paul Harrington
<pa...@mpx.com.au> writes

Quote
>One of our programmer is having trouble getting a database connection
>to say live when calling a DLL.  When the DLL is loaded that contains a
>dataware component he is forced to login to the Database again.

There is a fix for this in Delphi 2 but none in Delphi 1 AFAIK.

John
+-------------------+--------------------------------------------------+
John P.McCreesh     | Net:   jp...@pines.demon.co.uk
Forbo-Lancaster Ltd.| X.400: c=GB,a=CWMAIL,p=FORBO,s=McCreesh
Lancaster, England  | Voice: +44 (0)1524 65222 Fax: +44 (0)1524 61638

Other Threads