brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
20.01k stars 2.93k forks source link

DriverDataSource converts properties to String #1242

Open tucu00 opened 6 years ago

tucu00 commented 6 years ago

Environment

HikariCP version: 2.6.1 (by looking at the source, all branches seem to have the same issue)
JDK version     : 1.8.0_111
Database        : Snowflake
Driver version  : 0.9.1

⚠️ Snowflake JDBC driver can take a PrivateKey object as connection property (using put() instead of setProperty())

When creating a HirakiDataSource using Snowflake JDBC driver the datasource initialization fails because the connection property is not a PrivateKey.

Looking at the DriverDataSource constructor all properties are forced to String when the data source is being created:

driverProperties.setProperty(entry.getKey().toString(), entry.getValue().toString());

The issue can be fixed by changing the above line to:

driverProperties.put(entry.getKey().toString(), entry.getValue());

I've tried and it works correctly.

I understand that Properties is meant for String values, but given that implements a Hashtable<Object, Object> the put() method takes any object and JDBC drivers, like Snowflake, seems to take advantage of this to use non-string property values.


Have you searched the CLOSED issues already? How about checking stackoverflow?

brianwyka commented 3 years ago

I ran into this exact same issue with Snowflake.

AlanChaney commented 3 years ago

This is also true for Hikari 4.X. Is there any plan to implement the fix as above?