Great Thanks.
Would any of the two or anyone know how to capture the exception when a illegal value is trying to be inserted (using the PreparedStatement executeUpdate() )into a table?
For example:
try{
String murInsertQry = "INSERT INTO table (id, iDdesc, idtype) VALUES (?,?,?)";
PreparedStatement preparedStmt = db.prepareStatement(murInsertQry);
while(!(myVector.isEmpty())){
preparedStmt.setInt(1, id);
preparedStmt.setString(2, idDesc);
preparedStmt.setInt(3, idType);
int
test = preparedStmt.executeUpdate();
}
}catch(Exception e){
e.printStackTrace();
}
The problem is that I could process most of my data and insert them in but when I run into a illegal value such as duplicate id's, I get an exception and the program terminates the loop without process the other records. How would I know to capture the exception and still continue through the loop and insert? That is why I created the int test variable but at that point it is too late. Thanks in advance for any suggestions.
Allen