|
The problem is as follows:
public int insertForm () {
String strsql = "";
String strtime = "";
try {
Connection conn = db.getConnection ();
strtime = db.getCurrentDate ("yyyy-MM-dd HH: mm: ss");
strsql = "insert into productor (cpmc, bbh, cpgn, lbid, moreinfo) values (?,?,?,?,?)"; // where cpgn and moreinfo are Clob-type fields in the database
PreparedStatement pstmt = conn.prepareStatement (strsql);
pstmt.setString (1, form.getCpmc ());
pstmt.setString (2, form.getBbh ());
oracle.sql.CLOB clob1 = oracle.sql.CLOB.createTemporary (conn, false, oracle.sql.CLOB.DURATION_CALL);
clob1.putString (1, form.getContent ()); // Convert form.getContent () (its value is String) into a CLOB type and insert it into the database
pstmt.setClob (3, clob1);
pstmt.setInt (4, Integer.parseInt (form.getCplx ()));
oracle.sql.CLOB clob2 = oracle.sql.CLOB.createTemporary (conn, false, oracle.sql.CLOB.DURATION_CALL);
clob2.putString (1, form.getXxxx ()); // Convert form.getXxxx () (its value is String) into CLOB type and insert it into the database
pstmt.setClob (5, clob2);
pstmt.executeUpdate ();
conn.commit ();
pstmt.close ();
db.close ();
} catch (Exception e) {
db.rollback ();
e.printStackTrace ();
return 2;
e.printStackTrace ();
} finally {
db.close ();
}
return 0;
}
An error occurred while the program was running! java.sql.SQLException: Cannot read more data from the socket
I don't know what's wrong! Please master to see if there is a problem with the program! speed. . . . |
|