比如对:pkg_util.setdata(a date)我用
PreparedStatement stmt;
Timestamp x = new Timestamp(dt.getTime()); 
stmt.setTimestamp(i,x);好像不管用。

解决方案 »

  1.   

    String userid,
    String state,
    Date dateTime,
    String tn,
    String tr)
    throws SQLException {
    Connection con = null;
    PreparedStatement ps = null;
    try {
    con = this.getConnection();
    ps = con.prepareStatement(INSERT_ALL_SQL);
    userid = this.getSubString(userid,8);
    state = this.getSubString(state,20);
    tn = this.getSubString(tn,40);
    tr = this.getSubString(tr,8);
    ps.setString(1, userid.toUpperCase());
    ps.setString(2, state);
    if (dateTime != null)
    ps.setTimestamp(3, new Timestamp(dateTime.getTime()));
    else
    //ps.setTimestamp( 3, null );
    ps.setTimestamp(3, new Timestamp(new Date().getTime())); // modified by lcl at 2006-07-14

    ps.setString(4, tn);
    ps.setString(5, tr); int result = ps.executeUpdate(); } catch (SQLException sex) {
    throw sex;
    } finally {
    if (ps != null)
    ps.close();
    this.closeConnection();
    }
    }
      

  2.   

    把时间按long类型来存储,读的时候转换一下,应该不能更精确了吧