funcool/clojure.jdbc

Documentation question

Closed this issue · 1 comments

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).

Is the difference between clojure.jdbc support for HikariCP caused by a third-party adapter that is not dbspec compliant?

Also, HikariCP adapter targets to only JDK8 version.

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

Thanks.

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