一直试图将数据插入oracle。我对其进行了排查,并设法获得system.out.println
1和2.
这是我的代码。 PS。我怀疑使用jDatepicker可能是日期。
private void AddActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
String startDate = formatter.format(csd.getDate());
String endDate = formatter.format(ced.getDate());
String id = cid.getText();
String name = cname.getText();
int year = cyear.getYear();
String ccountry = country.getText();
String ccity = city.getText();
String cvenue = venue.getText();
String contactemail = email.getText();
try{
Connection dbConnection = getDBConnection();
System.out.println(1);
String insert = "insert into conference values(?,?,?,?,?,?,?,?,?)";
PreparedStatement ps = dbConnection.prepareStatement(insert);
ps.setString(1, id);
ps.setString(2, name);
ps.setInt(3, year);
ps.setString(4, startDate);
ps.setString(5, endDate);
ps.setString(6, ccountry);
ps.setString(7, ccity);
ps.setString(8, cvenue);
ps.setString(9, contactemail);
System.out.println(2);
ps.executeUpdate();
System.out.println("louis");
}
catch (Exception ex) {
}
}