Board index » delphi » Using one Databse Connection in many apps ?

Using one Databse Connection in many apps ?

Hi !

I want to use the same IBDatabase Compnent in many apps,
cause opening the IBdatabse Component is very slow about 2 secs (on my
machine)
and I have many Apps using the same Database.
So my Idea was to share the DBComponent -> I tried to share it over a DLL,
cause
delphi packages wont allow global variables ...

Does anyone have any good ideas ? - Thanks a lot ...

 heli

 

Re:Using one Databse Connection in many apps ?


Quote
Helmut Hartl wrote:

> I want to use the same IBDatabase Compnent in many apps,
> cause opening the IBdatabse Component is very slow about 2 secs (on my
> machine)
> and I have many Apps using the same Database.

        This is possible, but it will be entirely up to you to ensure that no
two programs attempt to access the connection at the same time.  This
can be very tricky.

        One option for connection sharing is to use a single-instance DataSnap
server.

        That said, I think you would do better to fix the problem than to work
around it.  It shouldn't take 2 seconds to open a connection, and you
shouldn't need to do it frequently.  The first thing I'd check is to
make sure your server is in your clients' hosts files.  You may be doing
a slow DNS lookup.

        HTH,

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:Using one Databse Connection in many apps ?


You can't share the connection across threads/processes.  Only one thread at a
time would be able to access our connection.  There is no out of process pooler
that I know of.

Quote
Helmut Hartl wrote:

> Hi !

> I want to use the same IBDatabase Compnent in many apps,
> cause opening the IBdatabse Component is very slow about 2 secs (on my
> machine)
> and I have many Apps using the same Database.
> So my Idea was to share the DBComponent -> I tried to share it over a DLL,
> cause
> delphi packages wont allow global variables ...

> Does anyone have any good ideas ? - Thanks a lot ...

>  heli

--
Jeff Overcash (TeamB)   | Talk about failure
(Please do not email    | To fall is not to fail
 me directly unless     | Failure isn't about falling down
 asked.  Thank You)     | Failure is staying down (Marillion)

Re:Using one Databse Connection in many apps ?


Quote
> It shouldn't take 2 seconds to open a connection, and you
> shouldn't need to do it frequently.  The first thing I'd check is to
> make sure your server is in your clients' hosts files.  You may be doing
> a slow DNS lookup.

-------------------------------------
I have the same behavior - about 2 seconds to open a connection, and my DB
is on the same machine as my client.

Re:Using one Databse Connection in many apps ?


InterBase seems to have a bug that makes _secondary_ connections very slow
on connection. The connection time is at least one second. This is behaviour
comes from a server side thread that always sleeps 1 second when creating a
secondary connection - I believe it has something to do with transaction
header pages or something...

--
Martijn Tonies
Upscene Productions

InterBase Workbench - The Developer Tool for InterBase
http://www.interbaseworkbench.com

"Ron" <ron...@no.spam.earthlink.net> schreef in bericht
news:3be24d4e_2@dnews...

Quote

> > It shouldn't take 2 seconds to open a connection, and you
> > shouldn't need to do it frequently.  The first thing I'd check is to
> > make sure your server is in your clients' hosts files.  You may be doing
> > a slow DNS lookup.
> -------------------------------------
> I have the same behavior - about 2 seconds to open a connection, and my DB
> is on the same machine as my client.

Re:Using one Databse Connection in many apps ?


The second connection is very slow to me also ! Why ?????

"Craig Stuntz (TeamB)" <cstuntz@no_spam.vertexsoftware.com> schreef in
bericht news:3BE16C25.53481326@no_spam.vertexsoftware.com...

Quote

> Helmut Hartl wrote:

> > I want to use the same IBDatabase Compnent in many apps,
> > cause opening the IBdatabse Component is very slow about 2 secs (on my
> > machine)
> > and I have many Apps using the same Database.

> This is possible, but it will be entirely up to you to ensure that no
> two programs attempt to access the connection at the same time.  This
> can be very tricky.

> One option for connection sharing is to use a single-instance DataSnap
> server.

> That said, I think you would do better to fix the problem than to work
> around it.  It shouldn't take 2 seconds to open a connection, and you
> shouldn't need to do it frequently.  The first thing I'd check is to
> make sure your server is in your clients' hosts files.  You may be doing
> a slow DNS lookup.

> HTH,

> -Craig

> --
>  Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
> We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
>      Delphi/InterBase WebLog: http://delphi.weblogs.com

Re:Using one Databse Connection in many apps ?


Quote
"Arno Brinkman [BISIT]" wrote:

> The second connection is very slow to me also ! Why ?????

        Martijn's report seems to be correct that the second connection is
slower -- I've reported this to InterBase QA -- but it still shouldn't
take 2 seconds.

        -Craig

--
 Craig Stuntz (TeamB) Vertex Systems Corp. Columbus, OH
We're hiring: http://www.vertexsoftware.com/careerops.htm#sd
     Delphi/InterBase WebLog: http://delphi.weblogs.com

Other Threads