The Artima Developer Community
Sponsored Link

Java Answers Forum
Get insert record OID after inserting a record

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
linjyloo

Posts: 2
Nickname: mistella
Registered: Apr, 2005

Get insert record OID after inserting a record Posted: Apr 15, 2005 10:54 PM
Reply to this message Reply
Advertisement
Good day everyone =)

I need to get inserted record OID once i insert a record into MySQL DB. below is my current 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();
return (-1);
}


Table Record(
OID int primary key auto increament,
name varchar2(100)
)

Anyone who know please advise me, thanks in advance ;)

Topic: hangman Previous Topic   Next Topic Topic: Waiting for Thread/Runnable Close/Stop confirmation before enabling Start

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use