Page 1 of 1

How to implement a ZeosLib connection pool. ZDbcPooled.pas??

Posted: 26.12.2014, 15:17
by JD
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

Re: How to implement a ZeosLib connection pool. ZDbcPooled.pas??

Posted: 08.01.2015, 12:08
by JD
Can anybody please give me some clues? I will really appreciate it.

JD

Re: How to implement a ZeosLib connection pool. ZDbcPooled.pas??

Posted: 08.01.2015, 20:16
by marsupilami
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

Re: How to implement a ZeosLib connection pool. ZDbcPooled.pas??

Posted: 11.01.2015, 09:07
by EgonHugeist
JD,

just FYI: have to pass. Never used the component :?