hudi
hudi

Reputation: 16525

Where to find list of exceptions and when their occurs

I am using SimpleJdbcTemplate to connect to database. Where I can found all exception and also when they are thrown? I know just few for example:

org.springframework.jdbc.BadSqlGrammarException

occurs when the SQL query has bad grammar. But I need to know more for example what exception is thrown when database is unreachble or there is lock etc.

Upvotes: 0

Views: 705

Answers (4)

user647772
user647772

Reputation:

Take a look at the API of SimpleJdbcTempate. I find this exceptions:

which has these known subclasses:

  • NonTransientDataAccessException with subclasses:
    • CleanupFailureDataAccessException
    • DataIntegrityViolationException
    • DataRetrievalFailureException
    • DataSourceLookupFailureException
    • InvalidDataAccessApiUsageException
    • InvalidDataAccessResourceUsageException
    • NonTransientDataAccessResourceException
    • PermissionDeniedDataAccessException
    • UncategorizedDataAccessException
  • RecoverableDataAccessException
  • TransientDataAccessException with subclasses:
    • ConcurrencyFailureException
    • QueryTimeoutException
    • TransientDataAccessResourceException

Read the documentation on JdbcTemplate in the Spring guide, too.

Upvotes: 2

Vincent Ramdhanie
Vincent Ramdhanie

Reputation: 103135

You will find these details in the JavaDoc for the framework. Here are the 3.0.x docs. If you look in the package org.springframework.jdbc you will find several exceptions listed.

Upvotes: 0

Subba
Subba

Reputation: 406

Refer the Spring API

http://static.springsource.org/spring/docs/3.0.x/javadoc-api/

a couple of exceptions list ...

BadSqlGrammarException 
CannotGetJdbcConnectionException 
IncorrectResultSetColumnCountException 
InvalidResultSetAccessException 
JdbcUpdateAffectedIncorrectNumberOfRowsException 
LobRetrievalFailureException 
SQLWarningException 
UncategorizedSQLException

Upvotes: 0

Tomasz Nurkiewicz
Tomasz Nurkiewicz

Reputation: 340743

In general you are looking for all subclasses of DataAccessException, starting from: TransientDataAccessException, NonTransientDataAccessException and RecoverableDataAccessException. Keep looking for subclasses.

There are plenty of such exceptions, you must read the JavaDocs to understand when they are thrown. Spring does a pretty good job of translating database-specific exceptions into standard hierarchy.

Upvotes: 0

Related Questions