import java.sql.CallableStatement; import java.sql.Connection; public class JSandBox { public static void main(String[] args) throws Exception { Connection con = null; try { com.mysql.jdbc.jdbc2.optional.MysqlDataSource ds = new com.mysql.jdbc.jdbc2.optional.MysqlDataSource(); ds.setUrl("jdbc:mysql://myhost:myport/mydb?noAccessToProcedureBodies=true"); ds.setUser("myuser"); ds.setPassword("mypassword"); con = ds.getConnection(); // Create CallableStatement CallableStatement cs = con.prepareCall("CALL myproc(?)"); // Registering input parameters cs.setString(1, "mystring"); // Execute the call statement cs.executeUpdate(); // Close resource cs.close(); System.out.println("It works :)"); con.close(); } catch (Exception e) { System.err.println("Exception: "+e.getMessage()); e.printStackTrace(); } } }