When the user tries to create a database object without a unique name, I want to display a custom error message. We are using SQLite and when an insert violates the uniqueness constraint we get a java.sql.SQLException.
The ex.getMessage output is "java.sql.SQLException: [SQLITE_CONSTRAINT] Abort due to constraint violation (column name is not unique)"
But getErrorCode returns 0 and getSQLState and return null. I expect the getErrorCode result to be 19. Sqlite Error Codes
How can I identify this specific exception without parsing the string looking for SQLITE_CONSTRAINT?
Aucun commentaire:
Enregistrer un commentaire