When writing java code that uses an Oracle database, one can always catch SQLException
an read an specific Oracle error with e.getErrorCode()
. For example, error 28001 means expired password, 28000 is blocked account, 1017 is wrong user/passsword, etc.
That way I can manage different errors the appropiate way.
But with PostgreSQL databases e.getErrorCode()
always returns 0, even when catching Postgres-specific PSQLException
.
The Question
Have you tried looking at getSqlState() instead? See also: http://www.postgresql.org/docs/9.3/static/errcodes-appendix.html