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 (rs.next()){
change = false;
for (int ctr = 1; ctr <= count; ++ ctr){
String temp = rs.getString(ctr);
if (!temp.equals(temp.toUpperCase())){
rs.updateString(ctr,
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.