Bug #13453 | DriverManager.getConnection: user/password containing = or & | ||
---|---|---|---|
Submitted: | 24 Sep 2005 1:41 | Modified: | 11 Nov 2009 2:35 |
Reporter: | Joe Knall | Email Updates: | |
Status: | Won't fix | Impact on me: | |
Category: | Connector / J | Severity: | S2 (Serious) |
Version: | 3.1.10 | OS: | Linux (Linux) |
Assigned to: | Mark Matthews | CPU Architecture: | Any |
[24 Sep 2005 1:41]
Joe Knall
[24 Sep 2005 3:09]
Mark Matthews
Until such time as the JDBC specification has defined what is meant by a "URL", I'm afraid we're at a loss to pick an appropriate encoding scheme for these "special" characters that won't be overridden when JDBC-4.0 is released as a final spec w/ Mustang (Java6), so we're going to take a wait-and-see so that we don't have a backwards-compatibility issue on our hands. The workaround for now is to pass them either in a java.util.Properties instance, or as individual strings using the DriverManager, Driver and/or DataSource methods that take those arguments, as those strings aren't parsed. In general, the DriverManager and Driver interfaces have been discouraged (but not deprecated yet) by Sun, so using DataSource with the mutators for setPassword() and setUser() is the preferred mechanism.
[24 Sep 2005 13:10]
Joe Knall
Thank you Mark This is working: String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql://192.168.2.4/test"; String user = "me"; String passwd = "a+b=c"; Class.forName(driver); Connection cn = DriverManager.getConnection(url, user, passwd); Please add a hint in the docs of the next release!