c3p0 icon indicating copy to clipboard operation
c3p0 copied to clipboard

password in null when using com.microsoft.sqlserver.jdbc.SQLServerDriver

Open sbaeumlisberger opened this issue 4 years ago • 0 comments

When using the user and password properties with com.microsoft.sqlserver.jdbc.SQLServerDriver the password passed to the SQLServerDataSource connect method is null.

The cause of this issue is that in the C3P0ImplUtils class the password is retrieved form the nested data source, but the getter for the password in the SQLServerDataSource is not public. Therfore the readMethod is null and the password is not retrieved.

We are using osgi and the datasource config looks like that:

osgi.jdbc.driver.name=Microsoft JDBC Driver for SQL Server
osgi.jdbc.driver.class=com.microsoft.sqlserver.jdbc.SQLServerDriver

url=jdbc:sqlserver://localhost:1433;databaseName=devdb;
user=dbuser
password=dbpass

dataSourceName=ds

pool=c3p0
xa=false

jdbc.c3p0.dataSourceName=ds

Here I have attached a little standalone maven project to reproduce the issue: project.zip

If you need more information, let me know.

sbaeumlisberger avatar Oct 26 '21 10:10 sbaeumlisberger