Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Updateable ResultSet Help

Philip Hung
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is a code snippet of my problem, I basically traverse the whole ResultSet and check each value and replace them with a corrected value if I found any violating a fix set of rules, for simplicity sake in this example I test if the value is lowercase and change it to uppercase: (I'm using an Oracle 8i database)
Connection con = DriverManager.getConnection(url,
"myLogin", "myPassword");
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE);
String schema = "Schema1";
ResultSet rs = stmt.executeQuery("Select alias.* from " + schema + ".mytable alias");
ResultSetMetaData rsMeta = rs.getMetaData();
int count = rsMeta.getColumnCount();
boolean change;
while ({
change = false;
for (int ctr = 1; ctr <= count; ++ ctr){
String temp = rs.getString(ctr);
if (!temp.equals(temp.toUpperCase())){
change = true;
if (change == true) {
rs.updateRow(); // Update changes
We have two table setup one for testing and one for development, configured as different schemas but with table structures created similarly. I use the above mentioned code on the development table and it works nicely. However, when I tested it against the testing table (by changing schema variable), the application seems to hang at the rs.updateRow() call. What are the possible explanation for this and how do I resolve this?
Please help. Thanks in advance.
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!