I created several stored procedures in the mysql database, but when I try to execute them, I get:
User does not have access to metadata required to determine stored procedure parameter types. If rights can not be granted, configure connection with "noAccessToProcedureBodies=true" to have driver generate parameters that represent INOUT strings irregardless of actual parameter types.
I added noAccessToProcedureBodies = true to my connection string, but I still get this message. I use the DriverManager.getConnection (url, user, password) method, and the URL that I use is
jdbc:mysql://[server-url]/[database-name]?noAccessToProcedureBodies=true
EDIT: I meant that I have a user called creautenti, which I use in this method to create new users:
public static boolean creazioneUtente(String user, String password) throws EccezioneDaMostrare{ if(apriConnessione(CREA_UTENTI_USER, CREA_UTENTI_PW, false)){ try{ conn.setAutoCommit(false); String sqlCommand="CREATE USER ? @'%' IDENTIFIED BY PASSWORD ?"; String sqlCommandGrant="GRANT EXECUTE ON salvataggi.* TO ? REQUIRE SSL;"; String sqlCommandGrantEx="GRANT SELECT ON `mysql`.`proc` TO ? @'%';"; PreparedStatement s=conn.prepareStatement(sqlCommand); PreparedStatement sGrant=conn.prepareStatement(sqlCommandGrant); PreparedStatement sGrantEx=conn.prepareStatement(sqlCommandGrantEx); s.setString(1, user); sGrant.setString(1, user); sGrantEx.setString(1, user); s.setString(2, mySQLPASSWORD(password)); s.execute(); sGrant.executeUpdate(); sGrantEx.executeUpdate(); conn.commit(); conn.setAutoCommit(true); chiudiConnessione(); return true; } catch(SQLException e){ try { conn.rollback(); } catch (SQLException e1) { String msg=String.format("Errore durante la connessione al server MySQL:\n Messaggio:%s \n Stato SQL:%s \n Codice errore:%s", e.getMessage(), e.getSQLState(), e.getErrorCode()); throw new EccezioneDaMostrare(msg); } chiudiConnessione(); return false; } } else return false; }
(the first line simply opens the connection to the server as creautenti, and conn is the Connection object). So I logged in as root on the server and named
GRANT SELECT ON `mysql`.`proc` TO 'creautenti'@'%' WITH GRANT OPTION;
who updated creautenti privileges accordingly, but when I call
GRANT SELECT ON `mysql`.`proc` TO '<username>'@'%';
registered as creautenti for any other user, privileges are not changed. All routines are in salvataggi, on which I grant EXECUTE privileges to each user, so I also donβt think that the problem.