Information in SQLException



Hi,

I am using JDBC to connect to a MySQL database. The database has a table 'customer' with a primary key that is automatically generated by my program. There is another unique key (customerID) which has to be entered by the user. When the user chooes a value for customerID that is already in use, I get an SQLException (SQLState 23000, detailMessage = 'Duplicate entry xy for key z').
When this SQLException occurs, I want to display an error message like 'Please chose another customer-ID' to the user.
My question is:
How do I know that the SLQException is thrown because of the duplicate customerID and not because of a duplicate primary key or any other sort of SQL error. Do I have to parse the detailMessage-String ? Is this string vendor independent ?


Regards,
Hombre
.