• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ResultSet Update problem with Oracle 9i using JDBC

 
Rupa S
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am using a sample JDBC code to connect to Oracle 9i.The following code snippet is being used:

Connection conn = DriverManager.getConnection
("jdbc racle ci8:@DXDB", "dxo", "dxo");

PreparedStatement stmt = conn.prepareStatement("select userid,keydata,description from dxo.user",
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rset = stmt.executeQuery();
rset.moveToInsertRow();


rset.updateInt(1,16);
rset.updateString(2, "testdatakey");
rset.updateString(3, "testdata for Oracle connection");
rset.insertRow();

rset.moveToCurrentRow();
 
Rupa S
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry the previous post was incomplete.

The code being used is causing some problems.When i iterate through the resultset to print all the rows of the table, the resultset does not have the data of newly inserted row.
Everytime it shows all the data except the freshly inserted data. This is causing problems in my application as the newly inserted data is not shown.

I explored web for this, everywhere its said that this kind of insertion mechansim using ResultSet object updates the ResultSet as well as the underlying database.
But in my case the ResultSet does not show the new data, where as the database has the newly inserted row.

Please help me in resolving this issue.

Thanks in advance.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic