Description:
Creating a CallableStatement for a
PROCEDURE XXX
without proper Privilegese
(needs GRANT SUPER ON *.*)
result in "FUCNTION XXX does not exist" not found.
Which is misleading as PROCEDURE XXX exist but
can not be accessed.
How to repeat:
// XXX has no SUPER privilege test
MysqlConnectionPoolDataSource myDs = new MysqlConnectionPoolDataSource();
myDs.setServerName ("localhost");
myDs.setDatabaseName("test");
myDs.setPassword ("xxx");
myDs.setUser ("xxx")
Connection con = myDs.getConnection();
CallableStatement cas = con.prepareCall("{CALL SP(?)}");
...
results in
Exception in thread "main" com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: FUNCTION SP does not exist
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:936)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2870)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1573)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1665)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3170)
at com.mysql.jdbc.Connection.execSQL(Connection.java:3099)
at com.mysql.jdbc.Statement.executeQuery(Statement.java:1169)
at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1285)
at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3670)
at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:702)
at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:513)
at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4422)
at com.mysql.jdbc.Connection.prepareCall(Connection.java:4496)
at com.mysql.jdbc.Connection.prepareCall(Connection.java:4470)
at SPTest.main(SPTest.java:22)
Suggested fix:
Fix DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1285)
To to more checks why the call of
"SHOW CREATE PROCEDURE "
actually fails
OR Check for the right Priviliges right away