我正在使用JDBC PreparedStatement
更新记录,而我不知道我哪里出错了。我认为excuteUpdate()
上发生异常或我的代码有什么问题吗?
我的更新代码如下面的代码
try {
cn.setAutoCommit(false);
ps=cn.prepareStatement("update ISEVAENQUIRY set DATED=?,SOURCE1 =?,SOURCE2=?,CALLON=?,CALLBY =?,NAMEN=?,SBIC=?,SBISMSSENTDATE=?"
+ ",NUMBER1=?,FORMFILLEDUPC =?,FORMFILLEDUPDATE=?,NUMBER2=?,FORMCOURIREDC=?,FORMCOURIREDDATE=?,EMAIL1 =?,FORMRECIC=?,FORMRECIDATE=?,EMAIL2 =?"
+ ",PAYEMNTRCC=?,PAYDATE=?,PAN=?,REMARKS=? where NUMBER1=?");
ps.setString(1,val[0] );
ps.setString(2,val[1] );
ps.setString(3,val[2] );
ps.setString(4,val[3] );
ps.setString(5,val[4] );
ps.setString(6,val[5] );
ps.setString(7,val[6] );
ps.setString(8,val[7] );
ps.setString(9,val[8] );
ps.setString(10,val[9] );
ps.setString(11,val[10] );
ps.setString(12,val[11] );
ps.setString(13,val[12] );
ps.setString(14,val[13] );
ps.setString(15,val[14] );
ps.setString(16,val[15] );
ps.setString(17,val[16] );
ps.setString(18,val[17] );
ps.setString(19,val[18] );
ps.setString(20,val[19] );
ps.setString(21,val[20] );
ps.setString(22,val[21] );
ps.setString(23,val[8] );
int c=ps.executeUpdate();
cn.commit();
if(c !=0)
{
result="updated";
System.out.println(result);
}
ps.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
当executeUpdate()
出现以下异常时
java.net.SocketInputStream.socketRead0(Native Method)
java.net.SocketInputStream.socketRead(Unknown Source)
java.net.SocketInputStream.read(Unknown Source)
java.net.SocketInputStream.read(Unknown Source)
oracle.net.ns.Packet.receive(Packet.java:283)
oracle.net.ns.DataPacket.receive(DataPacket.java:103)
oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:230)
oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1122)
oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1099)
oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:288)
oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
oracle.jdbc.driver.T4CPreparedStatement.executeForRows(T4CPreparedStatement.java:1010)
oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1315)
oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
oracle.jdbc.driver.OraclePreparedStatement.executeUpdate(OraclePreparedStatement.java:3657)
oracle.jdbc.driver.OraclePreparedStatementWrapper.executeUpdate(OraclePreparedStatementWrapper.java:1350)
com.iseva.Servlet.UpdateIsevaEnquery.doGet(UpdateIsevaEnquery.java:65)
javax.servlet.http.HttpServlet.service(HttpServlet.java:622)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1519)
org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1475)
java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Unknown Source)
我不明白为什么会这样,有人可以帮助我吗?