Пример #1
0
 public Date selectNow(Connection con) throws SQLException {
   Statement st = null;
   ResultSet rs = null;
   try {
     st = con.createStatement();
     rs = st.executeQuery("SELECT now()");
     rs.next();
     return JDBCUtils.getDate(rs, rs.getMetaData().getColumnName(1));
   } finally {
     cleanup(null, st, rs);
   }
 }
Пример #2
0
 public int lastInsertId(Connection con) throws SQLException {
   int ret = 0;
   Statement st = null;
   ResultSet rs = null;
   try {
     st = con.createStatement();
     rs = st.executeQuery(lastInsertIdQuery);
     if (rs.next()) {
       ret = rs.getInt(1);
     }
   } finally {
     JDBCUtils.cleanup(null, st, rs);
   }
   return ret;
 }