How to use connection pooling in multi threaded apps

Discussion of open issues, suggestions and bugs regarding IBDAC (InterBase Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Realtime
Posts: 6
Joined: Thu 19 Mar 2009 15:21

How to use connection pooling in multi threaded apps

Post by Realtime » Mon 19 Oct 2009 16:01

Hello

I have an application with a webserver and different database events, resulting in database access in different threads.
I find some reference info about connection pooling, and that I have to use one connection per thread. But I do not understand the interactions!

Is there an exaple for setting up and using a connection with connection pooling in a new thread?

Many thanks for any help and hint!

Plash
Devart Team
Posts: 2844
Joined: Wed 10 May 2006 07:09

Post by Plash » Tue 20 Oct 2009 08:16

In your thread create a TIBCConnection component. Set the Pooling property of TIBCConnection to True. When you call the Connect method the TIBCConnection component will automatically use the connection pool.

imeyer
Posts: 9
Joined: Mon 01 Mar 2010 16:24

Post by imeyer » Mon 01 Mar 2010 16:28

Plash wrote:In your thread create a TIBCConnection component. Set the Pooling property of TIBCConnection to True. When you call the Connect method the TIBCConnection component will automatically use the connection pool.
How can i do this ? if i create the TIBConnection in my Threade should this be an the execute part of it or in the thread create methode and what about the end of the thread could i destroy the created object or how i have to handle this

An Example in delphi would bee very usefull

thanks in advanced

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 04 Mar 2010 08:17

Pooling is thread safe, therefore you can create TIBConnection directly in your thread in the same way as in the single-threaded application.

Post Reply