简单,就转换为String就欧克了
@Test
public void test1() throws Exception {
Connection conn = DBUtil.getConnection();
String sql = " insert into pp values(?,?,?)";
PreparedStatement pst = conn.prepareStatement(sql);
pst.setInt(1, 8);
pst.setObject(2, "小梨花");
String dateStr = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
pst.setString(3, dateStr);
int res = pst.executeUpdate();
System.out.println(res);
}