1
Answer

Need help handling DataBase Access Exceptions

huangjjing

huangjjing

21y
1.8k
1
Sorry if my question is too simple to you. But I couldn't find the database access Exception names like NullConnectionException,SQLException kind of stuff in java. I want to catch the specific exceptions in my catch block, as follows: try{ //database access }catch(NullConnectionException ex) { throw new NullConnectionException ex(message); }catch(SQLException sqlex) { throw new SQLException (message1); }catch(Exception exp) { throw new Exception(message2); } Are there any Exceptions like NullConnectionException or SQLException that are specific for database access in C#? Or if not, how can I catch a specific exception when an exception occurs for database access? Thanks very much for your help.
Answers (1)