JDBC driver (java.sql.Driver impl., version 03.03.00.04) does not handle correct the connect's "Properties" instance

Connectivity

JDBC driver (java.sql.Driver impl., version 03.03.00.04) does not handle correct the connect's "Properties" instance

The driver's implementation of the method "Connection connect(String url, java.util.Properties info)"
does not read correctly the properties stored in the "info" input parameter.

The driver ignores the "user" and the "password" properties (and probably the other properties too)
if these properties are "default"/parent properties.

The following code fails to initialize the JDBC connection :

Class.forName("com.ncr.teradata.TeraDriver");
Properties parentProps = new Properties();
parentProps.setProperty("user","myUser");
parentProps.setProperty("password","myPassword");
Properties props = new Properties(parentProps);
//the connection establishment fails because the driver fails to find the user and the password:
Connection con = DriverManager.getConnection(dbUrl,props);

If parentProps are directly used, the connection creation succeeds !!!

This means that Teradata is not able to handle correctly the java.util.Properties objects !
Somewhere inside the driver, Hashtable methods are directly used (like get() or containsKey() ) and
parent/default properties are ignored !!
For getting a property or checking if it exists you should use only "getProperty()" !
Fragment from the java.util.Properties#getProperty(String key) javadoc:
* If the key is not found in this property list, the default property list,
* and its defaults, recursively, are then checked. The method returns
* null if the property is not found.

2 REPLIES
Teradata Employee

Re: JDBC driver (java.sql.Driver impl., version 03.03.00.04) does not handle correct the connect's "Properties" instance

This issue corresponds to JDBC RFC DR 119654 -- support default Properties with DriverManager.getConnection(url, Properties)
Teradata Employee

Re: JDBC driver (java.sql.Driver impl., version 03.03.00.04) does not handle correct the connect's "Properties" instance



In case it wasn't clear, this RFC was just created and has not yet been scheduled for a particular Teradata JDBC Driver release.