Hi there everyone,
I'm trying to implement a connection pool for an application of mine. I previously used Cary Jensen's connection pool but I later decided to write one of my own. Because I use Zeos 7.1.4 on Lazarus 1.2.6, I wrote a small class to handle connections to my database. However while debugging, I stumbled upon ZDbcPooled.pas & to my surprise it seemed to have the features I was trying to rewrite. The only problem I can't find examples of how it is used. It would be a good thing if it is made more prominent because it means it might be able to handle pooled connections to all databases that the ZeosLib supports.
So my question is this, does anyone have any examples of how ZDbcPooled.pas works?
Thanks,
JD
How to implement a ZeosLib connection pool. ZDbcPooled.pas??
Re: How to implement a ZeosLib connection pool. ZDbcPooled.pas??
Can anybody please give me some clues? I will really appreciate it.
JD
JD
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: How to implement a ZeosLib connection pool. ZDbcPooled.pas??
Hello JD,
I had a look at ZDbcPooled.pas. It seems to implement some kind of a simple caching mechanism for connections based on their DBC layer URL. It seems that this URL must be passed as the only option in the Parameters property of your TZConnection object. The background to this: Zeos drivers need to implement an interface that is derived from the JDBC specification. And in the same way as JDBC uses an URL for its drivers, Zeos does too. This URL contains all options that are set in the driver when you try to connect to the database. The options which these drivers support vary. So - your best option is to look up information about the DBC layer and understand at least its URL. Then you should go on to the driver you want to use and try to study its source code for the options it supports.
If you tell us a bit more about your project, which driver you intend to use and which options you intend to use, maybe somebody here on the forums can help you in piecing things together.
Best regards,
Jan
I had a look at ZDbcPooled.pas. It seems to implement some kind of a simple caching mechanism for connections based on their DBC layer URL. It seems that this URL must be passed as the only option in the Parameters property of your TZConnection object. The background to this: Zeos drivers need to implement an interface that is derived from the JDBC specification. And in the same way as JDBC uses an URL for its drivers, Zeos does too. This URL contains all options that are set in the driver when you try to connect to the database. The options which these drivers support vary. So - your best option is to look up information about the DBC layer and understand at least its URL. Then you should go on to the driver you want to use and try to study its source code for the options it supports.
If you tell us a bit more about your project, which driver you intend to use and which options you intend to use, maybe somebody here on the forums can help you in piecing things together.
Best regards,
Jan
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: How to implement a ZeosLib connection pool. ZDbcPooled.pas??
JD,
just FYI: have to pass. Never used the component
just FYI: have to pass. Never used the component
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/