The "One Laptop Per Child" project has a great device ready to ship, but there's no Java on there. Let's think about working together to put Java on OLPC!
My experiement indicates that IConnectionProfile.createConnection(f,u,p) ignores the u, p and always grabs them from the base properties (at least via the Oracle and Derby providers).
Am I missing something obvious?
Example:
If the setBaseProperties() call is commented out, changing the username/password has no effect.
String factoryId = connectionProfile.getProvider().getConnectionFactory("java.sql.Connection").getId();
con = connectionProfile.createConnection(factoryId,(username==null?"":username), (password==null?"":password));
//
// con will be non null even if a corresponding java.sql.Connection was not created.
//
Object rawConnection = con.getRawConnection();
Throwable e = con.getConnectException();
IConnectionProfile.createConnection(factor,u,p) ignores u & p
At 8:40 AM on Apr 9, 2008, Gregory Smith
wrote:
Am I missing something obvious?
Example:
If the setBaseProperties() call is commented out, changing the username/password has no effect.
Properties prop = connectionProfile.getBaseProperties();
prop.setProperty( PROP_USERNAME, username==null?"":username);
prop.setProperty( PROP_PASSWORD, password==null?"":password);
connectionProfile.setBaseProperties(prop);
String factoryId = connectionProfile.getProvider().getConnectionFactory("java.sql.Connection").getId();
con = connectionProfile.createConnection(factoryId,(username==null?"":username), (password==null?"":password));
//
// con will be non null even if a corresponding java.sql.Connection was not created.
//
Object rawConnection = con.getRawConnection();
Throwable e = con.getConnectException();
con.close();
if( rawConnection != null && e==null) { return; } // Connection OK
throw new Exception( e==null?"Unspecified connection error":e.getMessage());
0 replies so far (
Post your own)