Bug #38367 Procedure Paramater Meta Data Error
Submitted: 25 Jul 2008 11:28 Modified: 14 Aug 23:47
Reporter: Paul Mouton
Status: Verified
Category:Connector/J Severity:S3 (Non-critical)
Version:5.1.6 OS:Microsoft Windows (MySql AB 5.0.56. )
Assigned to: Mark Matthews Target Version:
Tags: PROCEDURE, Parameter, nullable
Triage: D3 (Medium)

[25 Jul 2008 11:28] Paul Mouton
Description:
MySql Procedure parameters do accept a null arguments.
The JDBC Meta Data does not indicate that.

How to repeat:
The attached test case demonstrate.

Suggested fix:
none
[25 Jul 2008 11:30] Paul Mouton
MySql test case

Attachment: NulabablePatameterBugReport.java (application/text, text), 2.55 KiB.

[10 Apr 13:52] Tonci Grgin
Verified as described using latest c/J 5.1 sources:
	try {
		this.stmt.executeUpdate("DROP PROCEDURE IF EXISTS nullableParameterTest");
        	this.stmt.executeUpdate("CREATE PROCEDURE nullableParameterTest (OUT nfact
VARCHAR(100), IN ccuenta VARCHAR(100),"
		+ "\nOUT ffact VARCHAR(100),"
		+ "\nOUT fdoc VARCHAR(100))"
		+ "\nBEGIN"
		+ "\nEND");
			
		DatabaseMetaData dbMeta = this.conn.getMetaData();
		this.rs = dbMeta.getProcedureColumns("test", null, "nullableParameterTest", null);
		while (this.rs.next()) {
		String columnName = this.rs.getString(4);
		Short columnType = new Short(this.rs.getShort(5));
		int columnTypeValue = columnType.intValue();
		Integer dataType = new Integer(this.rs.getInt(6));
		String columnTypeName = this.rs.getString(7);
		Integer dataLength = new Integer(this.rs.getInt(9));
		Short scale = new Short(this.rs.getShort(10));
		Short columnNullable = new Short(this.rs.getShort(12));
		assertTrue("Parameter " + columnName + " do not allow null arguments",
columnNullable.intValue() == java.sql.DatabaseMetaData.procedureNullable);
		      }
    	} finally {
			closeMemberJDBCResources();
	}

produces:
.Loading JDBC driver 'com.mysql.jdbc.Driver'
Done.

Done.

Connected to 5.1.31-log
java.vm.version         : 1.5.0_17-b04
java.vm.vendor          : Sun Microsystems Inc.
java.runtime.version    : 1.5.0_17-b04
os.name                 : Windows Server 2008
os.version              : null
sun.management.compiler : HotSpot Client Compiler
F
Time: 0,294
There was 1 failure:
1) testBug38367(testsuite.simple.TestBug38367)junit.framework.AssertionFailedError:
Parameter nfact do not allow null arguments

Just for sake of completeness, any value used for useInformationSchema makes no
difference.