Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

ResultSet Update problem with Oracle 9i using JDBC

 
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.
 
This is awkward. I've grown a second evil head. I'm going to need a machete and a tiny ad ...
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic