Recent

Author Topic: Best database pool library?  (Read 6448 times)

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Best database pool library?
« on: February 23, 2018, 04:26:14 pm »
I'm trying to find a solid database pool library but not having much luck.

I could roll my own basic pool but I'd rather use something good with built-in auto-reconnect, time-out handling, etc.

Anyone know of one that plays nice with FPC?

UniDAC looks like it has pooling but FPC/Lazarus is only supported in the "Trial" and "Professional with Source code" versions which is $700 for a single seat.

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Best database pool library?
« Reply #1 on: February 23, 2018, 09:16:53 pm »
Hard to convince people at work to try FPC without a good database pool library, databases are the life blood of business and without reliable pools scaling is an issue.

In the Java world we have several choice such as HikariCP, free and very well regarded, that's why I'm looking for free alternatives if possible.

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Best database pool library?
« Reply #2 on: February 23, 2018, 09:43:41 pm »
I have several posts in this forum on connection pooling for databases.

http://forum.lazarus.freepascal.org/index.php/topic,15946.msg258490.html#msg258490
http://forum.lazarus.freepascal.org/index.php/topic,29067.msg183020.html#msg183020

Here is another link to an actual implementation of a connection pool.
https://github.com/FMXExpress/delphipooling

JD

Edit: And some more stuff

Using Semaphores in Delphi, Part 2: The Connection Pool http://edn.embarcadero.com/article/30027
A database connection pool: https://cc.embarcadero.com/item/19975
« Last Edit: February 25, 2018, 11:39:34 am by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Best database pool library?
« Reply #3 on: February 25, 2018, 09:36:23 pm »
Thanks JD, I'm looking at your links.

At a glance, nothing looks as solid as what we have on the Java side (Proven libraries with lots of functionality) whereas much of the FPC stuff seems to be "I figured out how to make a pool" or "Here's an example of how you could build one".

Might be worth putting out some bounties..

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Best database pool library?
« Reply #4 on: February 25, 2018, 11:37:53 pm »
Thanks JD, I'm looking at your links.

At a glance, nothing looks as solid as what we have on the Java side (Proven libraries with lots of functionality) whereas much of the FPC stuff seems to be "I figured out how to make a pool" or "Here's an example of how you could build one".

Might be worth putting out some bounties..

It exists but most of the comparable stuff with Java database connection pools is closed source. The FPC (or FPC compatible) open source/GPL database connection pool source is old but fully functional. You may need to modify some things to get it to work for you.

For other options, you could also take a look
a) tipof framework http://tiopf.sourceforge.net
b) mORMot framework https://synopse.info/fossil/wiki/Synopse+OpenSource

They are well maintained and have connection pools in the code. However the learning curve can be a bit steep.

JD
« Last Edit: February 25, 2018, 11:44:37 pm by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

Trenatos

  • Hero Member
  • *****
  • Posts: 533
    • MarcusFernstrom.com
Re: Best database pool library?
« Reply #5 on: February 26, 2018, 02:04:53 am »
I looked at Mormot before but couldn't get it running, that was a while ago though so might be worth looking at again.

Tiopf seems interesting from a pool perspective, but in general I try to avoid ORMs.

Do you know if it's a big task to run straight up queries with it or is it all very tied into the ORM way of doing things?

JD

  • Hero Member
  • *****
  • Posts: 1848
Re: Best database pool library?
« Reply #6 on: February 26, 2018, 09:37:46 am »
I looked at Mormot before but couldn't get it running, that was a while ago though so might be worth looking at again.

Tiopf seems interesting from a pool perspective, but in general I try to avoid ORMs.

Do you know if it's a big task to run straight up queries with it or is it all very tied into the ORM way of doing things?

I agree with you on ORMs in general including Hibernate for Java. I like fine grained control over my SQL queries (JOINS, UNIONS, etc - all the advanced stuff) so I avoid using the ORM part of the frameworks.

So I just pick what I need from the framework and integrate that with the rest of my code. Reading through the code of these frameworks is/was a great learning process for me.

For example, mORMot's TDocVariant (in SynCommons.pas unit) and its conversion to/from JSON is everywhere in my code now whereas before I did not like to use variant types. It helped me get rid of TStringList since I no longer needed to free the object after usage eliminating many try .... finally code snippets in my code.

JD
« Last Edit: February 26, 2018, 09:43:03 am by JD »
Windows - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe),
Linux Mint - Lazarus 2.1/FPC 3.2 (built using fpcupdeluxe)

mORMot; Zeos 8; SQLite, PostgreSQL & MariaDB; VirtualTreeView

 

TinyPortal © 2005-2018