try {
// con = dbConn.mySqlConnection();
con = DatabaseConnection.getRAWConnection();
String insertSqlTable = "insert into certification VALUES(?,?,?,?,?,?,CURRENT_TIMESTAMP,?)";
pst = con.prepareStatement(insertSqlTable);
pst.setInt(1, td.getEmpId());
pst.setString(2, td.getRname());
pst.setString(3, td.getStream());
pst.setString(4, td.getCertificationType());
pst.setString(5, td.getCertificationName());
pst.setString(6, td.getCertificationDate());
//pst.setTimestamp(7, timestamp);
pst.setInt(7, td.getScore());
int count = pst.executeUpdate();
if (count >= 1) {
con.commit();
status = true;
} else {
System.out.println("Error occured while inserting certification details into database");
con.rollback();
status = false;
}
我得到以下異常:微軟SQL錯誤異常
com.microsoft.sqlserver.jdbc.SQLServerException:操作數類型衝突: INT與DATETIME2
可能是你表中沒有時間戳的第7列,向我們展示表結構 – SpringLearner