I am inserting millions of records using Batch update process. I mean preparedStatement and executeBatch method. for ex. when I insert 100000 records, sometimes some records fail to get inserted because the data doesn't match correctly to columns in the table. I want to capture this data into an exception table. But how do I know what was the sql error that caused it. If I am not using executeBatch Method. It tells what sql exception it was. But How do I capture it in Batch process. int updateCounts = preparedstatment.executeBatch(); updateCounts only has -2 or -3 based on success and failure of insert. How do I know what is the reason for the failure, what SQLException it has.