Bug #9769 Passing in NULL procedureNamePattern to getProcedures() causes error
Submitted: 8 Apr 2005 16:49 Modified: 14 Apr 2005 20:34
Reporter: Kate Email Updates:
Status: Closed Impact on me:
Category:Connector / J Severity:S2 (Serious)
Version:3-17 OS:Windows (Windows)
Assigned to: Mark Matthews CPU Architecture:Any

[8 Apr 2005 16:49] Kate
We have been using this API call, getProcedures(), for many versions.  We have always been passing in NULL for the procedureNamePattern if we want it to match all patterns.  However using this method in version 3-17 causes the following error:

java.sql.SQLException: Procedure name pattern can not be NULL or empty.
 at com.mysql.jdbc.DatabaseMetaData.getProcedures(DatabaseMetaData.java:2740)
 at util.TestJDBCandJNDI.listStorProc(TestData.java:242)
 at util.TestData.main(TestData.java:23)

I looked through the changelog and was not able to see any reference to getProcedures() having been changed from 3-16 to 3-17.


How to repeat:
Call getProcedures() and pass in a NULL Procedure name pattern.

Suggested fix:
Either document or rollback the change to the original behaviour - that NULL matches all cases.

[11 Apr 2005 14:58] Mark Matthews
Accepting NULL is not JDBC compliant (and was therefore a bug). Since the behavior is undefined by the JDBC spec (or the SQL spec), this is not a bug. You will need to use "%" if you want to match _all_ procedures, just as the JDBC specification states.
[14 Apr 2005 20:34] Mark Matthews
Fixed for  3.1.8.

Should accept null for name pattern parameters in DBMD (meaning "%"), 
	  even though it isn't JDBC compliant, for legacy's sake. Disable by setting
	  connection property "nullNamePatternMatchesAll" to "false" (which will be 
	  the default value in C/J 3.2.x).