Ok people. I'm using db2 and if I try to execute the statement:
Update t set i = 10 where i = 123
this row where i = 123 doesn't exist and I get the following warning: SQL0100W No row was found for FETCH, UPDATE or DELETE; or the result of a
query is an empty table. SQLSTATE=02000
So far...everything's fine. Now I try to catch this warning through
jdbc. Here's my code:
import java.io.*;
import java.util.*;
import java.sql.*;
class PELoad {
static {
try {
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver").newInstance();
} catch (Exception e) {
System.out.println(e);
} //catch
} //static
public static void main(
String args[]) {
try {
Connection con = DriverManager.getConnection("jdbc

b2

ELoad");
Statement stmt = con.createStatement();
stmt.executeUpdate("Update t set i = 10 where i = 123");
SQLWarning warning = stmt.getWarnings();
if (warning != null) {
System.out.println("\n---Warning---\n");
while (warning != null) {
System.out.println("Message: " + warning.getMessage());
System.out.println("SQLState: " + warning.getSQLState());
System.out.print("Vendor error code: ");
System.out.println(warning.getErrorCode());
System.out.println("");
warning = warning.getNextWarning();
} //while
} //main
con.close();
} catch(Exception e) {System.out.println(e);}
} //main
} //PEload
compiles fine...java program...computer starts thinking...sbam! nothing happens, not even a little error message. Any idea what I'm doing wrong?