Invalid state, the PreparedStatement object is closed.

来源:百度知道 编辑:UC知道 时间:2024/06/17 09:17:38
java.sql.SQLException: Invalid state, the PreparedStatement object is closed.
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.checkOpen(JtdsPreparedStatement.java:186)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.getParameter(JtdsPreparedStatement.java:252)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setParameter(JtdsPreparedStatement.java:326)
at net.sourceforge.jtds.jdbc.JtdsPreparedStatement.setString(JtdsPreparedStatement.java:606)
at com.chinadim.musicclub.app.tool.SqlS.setString(SqlS.java:203)
at com.chinadim.musicclub.app.LogHandle.addLog(LogHandle.java:73)
at com.chinadim.musicclub.app.LogHandle.addLog(LogHandle.java:47)
at com.chinadim.musicclub.app.AppLogWriter.run(AppLogWriter.java:在服务器上测试的时候抛的异常,这个问题怎么解决.

Connection con = null;
PreparedStatement pstmt = null;
在实例化这两个对象后不要再调用其他含有这两个参数的方法,如果需要调用另一个数据查询的方法,那就放到实例化前调用,不知是不是有这个情况