Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: JDBC 9.0.0
-
Component/s: JDBC
-
Labels:None
-
Environment:
Any
Description
In CUBRIDDriver.class in the connect function, this code returns an exception:
if (!acceptsURL(paramString)) {
throw new CUBRIDException(CUBRIDJDBCErrorCode.invalid_url, paramString);
}
It should return null instead.
MySQL and PostgreSQL both have:
Properties props = null;
if ((props = parseURL(url, info)) == null) {
return null;
}
or something along that sort.
I have attached the test code. If you load the CUBRIDDriver (cubrid_jdbc.jar is loaded) and then load a MySQL or any other database (with the driver not being found), then try to connect to connect to the mysql database and it gives a CUBRID error.
This gives the impression of a bug from CUBRID, when in fact it's caused due to the missing MySQL driver. This was the normal error if the CUBRIDDriver was not loaded:
java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/test at java.sql.DriverManager.getConnection(Unknown Source) at java.sql.DriverManager.getConnection(Unknown Source) at stress.Test.<init>(Test.java:20) at stress.Test.main(Test.java:35)
The rule that was broken is that connect function must return "null" if driver url is not recognized:
http://docs.oracle.com/javase/7/docs/api/java/sql/Driver.html#connect(java.lang.String, java.util.Properties)
I quote here what the connect function does:
"Attempts to make a database connection to the given URL. The driver should return "null" if it realizes it is the wrong kind of driver to connect to the given URL. This will be common, as when the JDBC driver manager is asked to connect to a given URL it passes the URL to each loaded driver in turn."

Reported to http://bts4.nhncorp.com/nhnbts/browse/CUBRIDSUS-8919.