Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 326804

Summary: DBWS cannot execute certain Stored Procedure on MySql/J 5.1.13
Product: z_Archived Reporter: Mike Norman <michael.norman>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipselink.dbws-inbox
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
fix stored procedure invocation for MySQL none

Description Mike Norman CLA 2010-10-01 12:50:10 EDT
However the same Stored Proc works perfectly fine using
old MySql/J 5.1.7 driver jar
Comment 1 Mike Norman CLA 2010-10-01 13:33:45 EDT
CREATE PROCEDURE InOutArgsSP(IN T VARCHAR(20), OUT U VARCHAR(20), OUT V NUMERIC)
BEGIN
 set U = CONCAT('barf-' , T);
 set V = 55;
END


Local Exception Stack: 
Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.2.0.qualifier): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Parameter index of 2 is out of range (1, 0)
Error Code: 0
Call: { CALL emp.InOutArgsSP(?, ?, ?) }
	bind => [yuck, => U, => V]
Query: DataReadQuery()
	at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:683)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:526)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeCall(AbstractSession.java:990)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:206)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:192)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:263)
	at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelect(DatasourceCallQueryMechanism.java:245)
	at org.eclipse.persistence.queries.DataReadQuery.executeNonCursor(DataReadQuery.java:192)
	at org.eclipse.persistence.queries.DataReadQuery.executeDatabaseQuery(DataReadQuery.java:148)
	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:768)
	at org.eclipse.persistence.queries.DataReadQuery.execute(DataReadQuery.java:134)
	at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2402)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1301)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1283)
	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1257)
	at org.eclipse.persistence.internal.xr.QueryOperation.invoke(QueryOperation.java:333)
	at dbws.testing.simplesp.SimpleSPTestSuite.inOutArgsTest(SimpleSPTestSuite.java:340)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
	at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
	at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.sql.SQLException: Parameter index of 2 is out of range (1, 0)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1075)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:989)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:984)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:929)
	at com.mysql.jdbc.CallableStatement$CallableStatementParamInfo.checkBounds(CallableStatement.java:274)
	at com.mysql.jdbc.CallableStatement.checkParameterIndexBounds(CallableStatement.java:710)
	at com.mysql.jdbc.CallableStatement.checkIsOutputParam(CallableStatement.java:672)
	at com.mysql.jdbc.CallableStatement.registerOutParameter(CallableStatement.java:1846)
	at org.eclipse.persistence.internal.databaseaccess.OutputParameterForCallableStatement.set(OutputParameterForCallableStatement.java:103)
	at org.eclipse.persistence.internal.databaseaccess.DatabasePlatform.setParameterValueInDatabaseCall(DatabasePlatform.java:2113)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseCall.prepareStatement(DatabaseCall.java:671)
	at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:576)
	... 39 more
Comment 2 Mike Norman CLA 2010-10-01 16:26:20 EDT
I have opened a bug on MySql J/Connect:  http://bugs.mysql.com/bug.php?id=57183
Comment 3 Mike Norman CLA 2010-10-05 11:47:57 EDT
I have isolated what I believe the issue is - the inclusion of the
database schema name in the CALL stanza: { CALL emp.InOutArgsSP(?, ?, ?) }
                                                ^^^

Try to figure out if there is a way to elide it ...
Comment 4 Mike Norman CLA 2010-10-06 15:26:12 EDT
Created attachment 180369 [details]
fix stored procedure invocation for MySQL
Comment 5 Mike Norman CLA 2010-10-15 10:22:03 EDT
Fixed in SVN revision: 8334
Comment 6 Eclipse Webmaster CLA 2022-06-09 10:33:42 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink