Skip to content Skip to sidebar Skip to footer

How To Get Errors Details From Android.database.sqlexception?

I have a database in my android app with two separate columns that have a UNIQUE constraint. When entering data and an SQLException exception is thrown I want to know which field's

Solution 1:

The class java.lang.SQLException on which android.database.SQLException is based has methods int getErrorCode() and String getSQLState() which should be able to help you get details.

Solution 2:

Database constraints are mostly intended to catch programming errors.

If detecting duplicates is part of your app's logic, you should manually check for them.

Post a Comment for "How To Get Errors Details From Android.database.sqlexception?"