Git Product home page Git Product logo

Comments (1)

niwinz avatar niwinz commented on June 15, 2024

Hi @brettwooldridge

Hi, I am the lead developer of HikariCP and I have a question about the documentation. The ?documentation section for HikariCP starts with:

This adapter does not respects the standard dbspec format, it has its own format and depends
completely of used adapter. This is happens because HikariCP works as some kind of wrapper and it
forward almost all parameters to the wrapped datasource.

I am not sure what this means? All connection pools, including C3P0 and DBCP, "wrap" datasources. HikariCP wraps datasources in exactly the same way as other pools and should be just as transparent (indistinguishable from them).

Ok, it maybe I'm wrong about the wrapper concept, but hikaricp is the first one that makes me awareness about it. Having to specify the datasource class. Other connection pool libraries requires only a jdbc url and optionally username and password.

About dbspec, why is not compliant? (obvliously I'm talking about dbspec format used in clojure community)
Because, with difference to other connection pool libraries, hikaricp does not recommend use jdbc url and relies a lot of forwarding options to "inner" datasource, making the connection parameters very heterogeneous.

With any jdbc library:

jdbc:postgresql://hostname/dbname
jdbc:h2:mem: or jdbc:h2:/tmp/file.db

But with hikaricp, the recommended way is not setting this url, instead of it I should pass specific parameters of each datasource (and they slightly heterogeneous).

Example for postgresql

HikariConfig config = new HikariConfig();
config.setMaximumPoolSize(100);
config.setDataSourceClassName("org.postgresql.ds.PGSimpleDataSource");
config.addDataSourceProperty("serverName", "localhost");
config.addDataSourceProperty("port", "3306");
config.addDataSourceProperty("databaseName", "test");

Example for h2

HikariConfig config = new HikariConfig();
config.setMaximumPoolSize(100);
config.setDataSourceClassName("org.h2.jdbcx.JdbcDataSource");
config.addDataSourceProperty("url", "mem:")

Having this, the dbspec (clojure map with :subprotocol and :subname) it can not be translated directly and uniformly to specific parameters for each datasource class that are available (because each database datasource implementation has it own parameters, that makes it difficult make them in one uniform format) to specific format of each datasource.

Almost all connection libraries that I know, they abstract me from inner datasource class. They are only make me specify a jdbcUrl and optionally password and username. With hikaricp, I should pass a specific options of used datasource class, making connecting to different databases have to specify different kind of parameters. It is not bad, it simply different.

I'm really happy with hikaricp but, I cannot make my clojure adapter compatible with the same dbspec format like others, because of reasons exposed previously.

Also, HikariCP adapter targets to only JDK8 version.

HikariCP has both Java 6/7 support and Java 8 support via different JAR artifacts.

I know it, but I'm not using directly hikari (I'm really considering it), instead of it, I'm currently using https://github.com/tomekw/hikari-cp this one that I found on your hikaricp readme.

As I said previously, I'm still reconsidering using that library and make my own adaptation, making it available without any problems with support for java 6 7 and 8. Also, I'm not very happy with the license of tomekw/hikari-cp :D

Thanks to you for your fantastic work on hikaricp :D

from clojure.jdbc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.