Preparement方法问题

来源:互联网 发布:html视频播放器源码 编辑:程序博客网 时间:2024/05/01 18:37


java.sql.SQLException: Unable to retrieve metadata for procedure.at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)at com.mysql.jdbc.CallableStatement.extractProcedureName(CallableStatement.java:868)at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:699)at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:513)at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4583)at com.mysql.jdbc.Connection.prepareCall(Connection.java:4657)at com.mysql.jdbc.Connection.prepareCall(Connection.java:4631)at com.hfl.dao.impl.UserDaoImpl.save(UserDaoImpl.java:22)at com.hfl.test.UserDaoTest.main(UserDaoTest.java:23)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:601)at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)Process finished with exit code 0

解决方法:

 PreparedStatement ps = conn.prepareCall("INSERT  INTO tbl_user(name ,password ,email) VALUES (?,?,?)");
改成
 PreparedStatement ps = conn.prepareStatement("INSERT  INTO tbl_user(name ,password ,email) VALUES (?,?,?)");







来源:http://blog.csdn.net/guoxu775/article/details/5573770

0 0