Results 1 to 1 of 1
Thread: JDBC - Exception handling
-
JDBC - Exception handling
When querying database, exceptions might appear. JDBC provides getMessage() and getErrorCode() methods to handle those exceptions.:
Java Code:try { Statement s = conn.createStatement (); s.executeQuery ("XYZ"); // issue invalid query s.close (); } catch (SQLException e) { System.err.println ("Error message: " + e.getMessage ()); System.err.println ("Error number: " + e.getErrorCode ()); }
Similar Threads
-
How to use JDBC Template classes to control basic JDBC processing and error handling
By Java Tip in forum Java TipReplies: 0Last Post: 04-01-2008, 10:17 AM -
Exception Handling...
By focus_nitin in forum New To JavaReplies: 1Last Post: 02-16-2008, 03:13 AM -
How to use JDBC Template classes to control basic JDBC processing and error handling
By JavaBean in forum Java TipReplies: 0Last Post: 09-28-2007, 12:56 PM -
Jstl Exception Handling
By vamsidharpoosarla in forum JavaServer Pages (JSP) and JSTLReplies: 2Last Post: 07-18-2007, 06:17 AM -
JSTL Exception Handling
By chaatf in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-18-2007, 02:24 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks