This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Is there a generic way to get the details of an error so that handiling exceptions with custom messages for the user can work across databases?
I have SQL code that could generate a insertion of duplicate primary key SQLException and could generate a duplicate unique id SQLException. I am working with SQL Server, but we will be migrating to DB2 soon.
My thoughts were with getting the SQLException error code, but I think thats particular to databases?
Nick, Unfortunately you are correct that the code is database specific. Java 5 or 6 (I forget which, but I think it is 6) is supposed to solve this problem by providing more specific SQLException subclasse.