为什么我不能使用Java Web应用程序访问在数据库中创建的存储过程?
我可以使用MySQL工作台调用该过程并更新数据库表,并且可以从Java Web应用程序访问数据库以对数据库进行其他操作。
This is the code i used in JDBC
CallableStatement cs = con.prepareCall("{call credittransfer(?,?,?)}");
cs.setString(1, fromacc);
cs.setString(2, toacc);
cs.setInt(3, transcredits);
cs.execute();
java.sql.SQLSyntaxErrorException: PROCEDURE
s786a7ombsews2qi.credittransfer does not exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException
(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException
(SQLError.java:97)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException
(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.ClientPreparedStatement.executeInternal
(ClientPreparedStatement.java:970)
at com.mysql.cj.jdbc.ClientPreparedStatement.execute
(ClientPreparedStatement.java:387)
at com.mysql.cj.jdbc.CallableStatement.execute
(CallableStatement.java:842)
at package2.CreditTransferServlet.doPost(CreditTransferServlet.java:27)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:660)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)