Exceptions
Upcoming SlideShare
Loading in...5
×
 

Exceptions

on

  • 449 views

http://rajjdbc.blogspot.in/

http://rajjdbc.blogspot.in/

Statistics

Views

Total Views
449
Views on SlideShare
439
Embed Views
10

Actions

Likes
0
Downloads
1
Comments
0

1 Embed 10

http://rajjdbc.blogspot.in 10

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

Exceptions Exceptions Presentation Transcript

  • Exceptions java.sql.SQLException
  • • public class SQLException extends Exception implements Iterable<Throwable> • { • }
  • Exceptions that are thrown by JDBC • 1. SQL Exception • 2. SQLWarning • 3. DataTruncation
  • SQLException • The SQL syntax error that are found in the user given query are reflected by the SQLException. • This exception is thrown by many of the java.sql package methods. • The connectivity issues with the database and the coding errors such has trying to access a closed object give rise to such exceptions. • The details of SQL error or a null are returned by using the getNetException() method of the SQLException object and the vendorspecific error codes are retrieved by using the getErrorCode() method of the SQLException object.
  • SQLWarning • • • • • Import java.sql.SQLWarning; public class SQLWarning extends SQLException { } An exception that provides information on database access warnings. Warnings are silently chained to the object whose method caused it to be reported. • Warnings may be retrieved from Connection, Statement, and ResultSet objects. Trying to retrieve a warning on a connection after it has been closed will cause an exception to be thrown. Similarly, trying to retrieve a warning on a statement after it has been closed or on a result set after it has been closed will cause an exception to be thrown. Note that closing a statement also closes a result set that it might have produced.
  • DataTruncation • • • • • java.sql.DataTruncation public class DataTruncationextends SQLWarning { } An exception thrown as a DataTruncation exception (on writes) or reported as a DataTruncation warning (on reads) when a data values is unexpectedly truncated for reasons other than its having execeeded MaxFieldSize. • The SQLstate for a DataTruncation during read is 01004. • The SQLstate for a DataTruncation during write is 22001.