Class JTDSDataSourceFactory  
<https://github.com/ops4j/org.ops4j.pax.jdbc/blob/master/pax-jdbc-jtds/src/main/java/org/ops4j/pax/jdbc/jtds/impl/JTDSDataSourceFactory.java>doesn't
 
work properly when lowercase entries are used in the configuration and I 
think this is a defect. I'm using version 1.0.0 but I double-checked that 
the most recent code in the repository didn't solve this problem.

The class initially builds a connection property map based on the jdbc URL 
provided in the configuration (line 76). Properties not included in the URL 
are still populated in the map with empty values and map keys in uppercase. 
For example 'PASSWORD='.

The configuration properties are then parsed and the related key/pair's are 
added to the map without being uppercase'd, leading to double entries in 
the map for each properties: one in lowercase and one in uppercase (loop at 
line 77).

The properties are then injected in the data source object (loop at line 
80). Java reflection is being used for this step and it's using a 
case-insensitive logic to select the setter method to be used for injecting 
the property into the data source object (line 113). The uppercase and 
lowercase entries are ultimately overriding each other.

This can be reproduced with a configuration like this:

url=jdbc:jtds:sqlserver://my.server:1433/my-database;integratedSecurity=true;domain=my-domain;useNTLMv2=true
user=someuser
password=some-password

As I workaround, I had to uppercase my property keys and this works fine:

USER=someuser
PASSWORD=some-password

Regards

-- 
-- 
------------------
OPS4J - http://www.ops4j.org - [email protected]

--- 
You received this message because you are subscribed to the Google Groups 
"OPS4J" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to