View Single Post
Old 04-15-2005, 11:25 PM   #1 (permalink)
linjylo
Registered User
 
linjylo's Avatar
 
Join Date: Apr 2005
Posts: 3
linjylo is on a distinguished road
how to get inserted OID once insert a record into MySQL

Good day everyone

I need to retrieve inserted OID for record inserted

Code:
public int createRecord(Record record) throws SQLException
{
      String sql="insert into Record(name) values(?)";
      PreparedStatement pstmt = con.prepareStatement(sql,
      ResultSet.TYPE_SCROLL_INSENSITIVE,
      ResultSet.CONCUR_UPDATABLE);

      pstmt.setString(1, record.getName());
      int row=pstmt.executeUpdate();
      pstmt.close();

      int OID=-1;//how to get inserted OID?
      return (OID);
}
anyone who know please advise me, thanks in advance
linjylo is offline   Reply With Quote