db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lance J. Andersen" <Lance.Ander...@Sun.COM>
Subject Re: SQLNonTransientConnectionExceptions and SESSION_SEVERITY exceptions that are not '08XXX' spec clarification
Date Mon, 17 Sep 2007 20:15:00 GMT


Kathey Marsden wrote:
> There was a discussion started in DERBY-401 on this but I thought I 
> would submit it as a separate thread.  The JDBC 4.0 spec says in 
> section 8.5.1..
>
> "A NonTransient SQLException must extend the class
> SQLNonTransientException. A NonTransient SQLException would be thrown
> in instances where a retry of the same operation would fail unless the 
> cause of the
> SQLException is corrected. After a NonTransient SQLException occurs, the
> application can assume that the connection is still valid. For 
> SQLState class values
> that indicate non-transient errors but which are not specified in the 
> following table,
> an implementation may throw an instance of the class 
> SQLNonTransientException."
>
> TABLE 8-1 specifies which NonTransientSQLException subclass must be 
> thrown
> for a a given SQLState class value:
> TABLE 8-1 NonTransientSQLExeceptions Subclasses
> SQL State Class SQLNonTransientException Subclass
> .....
> 08 SQLNonTransientConnectionException
> .....
>
> Derby has quite a few exceptions which are SESSION_SEVERITY or greater 
> which are not SQLState Class '08'.  These exception cause loss of 
> connection by the application.  There is a list at the bottom of this 
> mail.  I thought all of these should be 
> SQLNonTransientConnectionExceptions, 
SQLNonTransientConnectionException aligns with SQL State class value 08 
from 23.1, table 32 of the sql2003 spec.
> because the cause loss of the connection, but according to the spec I 
> suppose they should be just SQLNonTransientExceptions (right now they 
> are thrown as regular SQLExceptions).
The higher level categories categories are there for grouping and to 
allow programmers to just catch the higher level exception if they do 
not care about specifics.  There are multiple subclasses for Connection 
failures defined in table 32, sounds like you might not be reporting the 
correct SQLState  class and sub class values today.

You need to err on the side of caution if you just start mapping your 
errors to non-predefined JDBC SQLException subclasses  based on the 
class value as you could have to change them later down the road if JDBC 
spec add them to a different or new subcategory going forward.
>
> With JDBC 4.0 do you still need to look at error codes to determine if 
> the connection is lost or is the expectation that users will use 
> isValid() to determine the status of the connection?
Depends on what you are doing there is no one size fits all answer here.
>
> Kathey
>
>
>
>
> Below is the list:
>
>
>           {{"08000","Connection closed by unknown interrupt.","40000"},
>             {"08001","A connection could not be established because 
> the security token is larger than the maximum allowed by the network 
> protocol.","40000"},
>             {"08001","A connection could not be established because 
> the user id has a length of zero or is larger than the maximum allowed 
> by the network protocol.","40000"},
>             {"08001","A connection could not be established because 
> the password has a length of zero or is larger than the maximum 
> allowed by the network protocol.","40000"},
>             {"08001","Required Derby DataSource property {0} not 
> set.","40000"},
>             {"08001","{0} : Error connecting to server {1} on port {2} 
> with message {3}.","40000"},
>             {"08001","SocketException: '{0}'","40000"},
>             {"08001","Unable to open stream on socket: '{0}'.","40000"},
>             {"08001","User id length ({0}) is outside the range of 1 
> to {1}.","40000"},
>             {"08001","Password length ({0}) is outside the range of 1 
> to {1}.","40000"},
>             {"08001","User id can not be null.","40000"},
>             {"08001","Password can not be null.","40000"},
>             {"08001","A connection could not be established because 
> the database name '{0}' is larger than the maximum length allowed by 
> the network protocol.","40000"},
>             {"08003","No current connection.","40000"},
>             {"08003","getConnection() is not valid on a closed 
> PooledConnection.","40000"},
>             {"08003","Lob method called after connection was 
> closed","40000"},
>             {"08003","The underlying physical connection is stale or 
> closed.","40000"},
>             {"08004","Connection refused : {0}","40000"},
>             {"08004","Connection authentication failure occurred.  
> Reason: {0}.","40000"},
>             {"08004","The connection was refused because the database 
> {0} was not found.","40000"},
>             {"08004","Database connection refused.","40000"},
>             {"08004","User '{0}' cannot shut down database '{1}'. Only 
> the database owner can perform this operation.","40000"},
>             {"08004","User '{0}' cannot (re)encrypt database '{1}'. 
> Only the database owner can perform this operation.","40000"},
>             {"08004","User '{0}' cannot hard upgrade database '{1}'. 
> Only the database owner can perform this operation.","40000"},
>             {"08004","Connect refused to database '{0}' because it is 
> in replication slave mode.","40000"},
>             {"08006","An error occurred during connect reset and the 
> connection has been terminated.  See chained exceptions for 
> details.","40000"},
>             {"08006","Database '{0}' shutdown.","45000"},
>             {"0A000","The DRDA command {0} is not currently 
> implemented.  The connection has been terminated.","40000"},
>             {"57017","There is no available conversion for the source 
> code page, {0}, to the target code page, {1}.  The connection has been 
> terminated.","40000"},
>             {"58009","Network protocol exception: only one of the VCM, 
> VCS length can be greater than 0.  The connection has been 
> terminated.","40000"},
>             {"58009","The connection was terminated because the 
> encoding is not supported.","40000"},
>             {"58009","Network protocol exception: actual code point, 
> {0}, does not match expected code point, {1}.  The connection has been 
> terminated.","40000"},
>             {"58009","Network protocol exception: DDM collection 
> contains less than 4 bytes of data.  The connection has been 
> terminated.","40000"},
>             {"58009","Network protocol exception: collection stack not 
> empty at end of same id chain parse.  The connection has been 
> terminated.","40000"},
>             {"58009","Network protocol exception: DSS length not 0 at 
> end of same id chain parse.  The connection has been 
> terminated.","40000"},
>             {"58009","Network protocol exception: DSS chained with 
> same id at end of same id chain parse.  The connection has been 
> terminated.","40000"},
>             {"58009","Network protocol exception: end of stream 
> prematurely reached while reading InputStream, parameter #{0}.  The 
> connection has been terminated.","40000"},
>             {"58009","Network protocol exception: invalid FDOCA LID.  
> The connection has been terminated.","40000"},
>             {"58009","Network protocol exception: SECTKN was not 
> returned.  The connection has been terminated.","40000"},
>             {"58009","Network protocol exception: only one of NVCM, 
> NVCS can be non-null.  The connection has been terminated.","40000"},
>             {"58009","Network protocol exception: SCLDTA length, {0}, 
> is invalid for RDBNAM.  The connection has been terminated.","40000"},
>             {"58009","SocketException: '{0}'","40000"},
>             {"58009","A communications error has been detected: 
> {0}.","40000"},
>             {"58009","An error occurred during a deferred connect 
> reset and the connection has been terminated.  See chained exceptions 
> for details.","40000"},
>             {"58009","Insufficient data while reading from the network 
> - expected a minimum of {0} bytes and received only {1} bytes.  The 
> connection has been terminated.","40000"},
>             {"58009","Attempt to fully materialize lob data that is 
> too large for the JVM.  The connection has been terminated.","40000"},
>             {"58009","Network protocol exception: SCLDTA length, {0}, 
> is invalid for RDBCOLID.  The connection has been terminated.","40000"},
>             {"58009","Network protocol exception: SCLDTA length, {0}, 
> is invalid for PKGID.  The connection has been terminated.","40000"},
>             {"58009","Network protocol exception: PKGNAMCSN length, 
> {0}, is invalid at SQLAM {1}.  The connection has been 
> terminated.","40000"},
>             {"58009","A network protocol error was encountered and the 
> connection has been terminated: {0}","40000"},
>             {"58010","A network protocol error was encountered.  A 
> connection could not be established because the manager {0} at level 
> {1} is not supported by the server.","40000"},
>             {"58014","The DDM command 0x{0} is not supported.  The 
> connection has been terminated.","40000"},
>             {"58015","The DDM object 0x{0} is not supported.  The 
> connection has been terminated.","40000"},
>             {"58016","The DDM parameter 0x{0} is not supported.  The 
> connection has been terminated.","40000"},
>             {"58017","The DDM parameter value 0x{0} is not supported.  
> An input host variable may not be within the range the server 
> supports.  The connection has been terminated.","40000"},
>             {"XBM01","Startup failed due to an exception. See next 
> exception for details.","45000"},
>             {"XBM02","Startup failed due to missing functionality for 
> {0}. Please ensure your classpath includes the correct Derby 
> software.","45000"},
>             {"XBM03","Supplied value '{0}' for collation attribute is 
> invalid, expecting UCS_BASIC or TERRITORY_BASED.","45000"},
>             {"XBM05","Startup failed due to missing product version 
> information for {0}.","45000"},
>             {"XBM06","Startup failed. An encrypted database cannot be 
> accessed without the correct boot password.","45000"},
>             {"XBM07","Startup failed. Boot password must be at least 8 
> bytes long.","45000"},
>             {"XBM08","Could not instantiate {0} StorageFactory class 
> {1}.","45000"},
>             {"XBM0G","Failed to start encryption engine. Please make 
> sure you are running Java 2 and have downloaded an encryption provider 
> such as jce and put it in your class path.","45000"},
>             {"XBM0H","Directory {0} cannot be created.","45000"},
>             {"XBM0I","Directory {0} cannot be removed.","45000"},
>             {"XBM0J","Directory {0} already exists.","45000"},
>             {"XBM0K","Unknown sub-protocol for database name 
> {0}.","45000"},
>             {"XBM0L","Specified authentication scheme class {0} does 
> implement the authentication interface {1}.","45000"},
>             {"XBM0M","Error creating instance of authentication scheme 
> class {0}.","45000"},
>             {"XBM0N","JDBC Driver registration with 
> java.sql.DriverManager failed. See next exception for details.","45000"},
>             {"XBM0P","Service provider is read-only. Operation not 
> permitted.","45000"},
>             {"XBM0Q","File {0} not found. Please make sure that backup 
> copy is the correct one and it is not corrupted.","45000"},
>             {"XBM0R","Unable to remove File {0}.","45000"},
>             {"XBM0S","Unable to rename file '{0}' to '{1}'","45000"},
>             {"XBM0T","Ambiguous sub-protocol for database name 
> {0}.","45000"},
>             {"XBM0X","Supplied territory description '{0}' is invalid, 
> expecting ln[_CO[_variant]]\nln=lower-case two-letter ISO-639 language 
> code, CO=upper-case two-letter ISO-3166 country codes, see 
> java.util.Locale.","45000"},
>             {"XBM0Y","Backup database directory {0} not found. Please 
> make sure that the specified backup path is right.","45000"},
>             {"XBM0Z","Unable to copy file '{0}' to '{1}'. Please make 
> sure that there is enough space and permissions are correct.","45000"},
>             {"XCW00","Unsupported upgrade from '{0}' to '{1}'.","45000"},
>             {"XJ004","Database '{0}' not found.","40000"},
>             {"XJ015","Derby system shutdown.","50000"},
>             {"XJ028","The URL '{0}' is not properly formed.","40000"},
>             {"XJ040","Failed to start database '{0}', see the next 
> exception for details.","40000"},
>             {"XJ041","Failed to create database '{0}', see the next 
> exception for details.","40000"},
>             {"XJ049","Conflicting create attributes specified.","40000"},
>             {"XJ05B","JDBC attribute '{0}' has an invalid value '{1}', 
> valid values are '{2}'.","40000"},
>             {"XJ081","Conflicting create/restore/recovery attributes 
> specified.","40000"},
>             {"XJ213","The traceLevel connection property does not have 
> a valid format for a number.","40000"},
>             {"XSDB0","Unexpected exception on in-memory page 
> {0}","45000"},
>             {"XSDB1","Unknown page format at page {0}","45000"},
>             {"XSDB2","Unknown container format at container {0} : 
> {1}","45000"},
>             {"XSDB3","Container information cannot change once 
> written: was {0}, now {1}","45000"},
>             {"XSDB4","Page {0} is at version {1}, the log file 
> contains change version {2}, either there are log records of this page 
> missing, or this page did not get written out to disk 
> properly.","45000"},
>             {"XSDB5","Log has change record on page {0}, which is 
> beyond the end of the container.","45000"},
>             {"XSDB6","Another instance of Derby may have already 
> booted the database {0}.","45000"},
>             {"XSDB7","WARNING: Derby (instance {0}) is attempting to 
> boot the database {1} even though Derby (instance {2}) may still be 
> active.  Only one instance of Derby should boot a database at a time. 
> Severe and non-recoverable corruption can result and may have already 
> occurred.","45000"},
>             {"XSDB8","WARNING: Derby (instance {0}) is attempting to 
> boot the database {1} even though Derby (instance {2}) may still be 
> active.  Only one instance of Derby should boot a database at a time. 
> Severe and non-recoverable corruption can result if 2 instances of 
> Derby boot on the same database at the same time.  The 
> db2j.database.forceDatabaseLock=true property has been set, so the 
> database will not boot until the db.lck is no longer present.  
> Normally this file is removed when the first instance of Derby to boot 
> on the database exits, but it may be left behind in some shutdowns.  
> It will be necessary to remove the file by hand in that case.  It is 
> important to verify that no other VM is accessing the database before 
> deleting the db.lck file by hand.","45000"},
>             {"XSDB9","Stream container {0} is corrupt.","45000"},
>             {"XSDBA","Attempt to allocate object {0} failed.","45000"},
>             {"XSDG0","Page {0} could not be read from disk.","45000"},
>             {"XSDG1","Page {0} could not be written to disk, please 
> check if disk is full.","45000"},
>             {"XSDG2","Invalid checksum on Page {0}, expected={1}, 
> on-disk version={2}, page dump follows: {3}","45000"},
>             {"XSDG3","Meta-data for Container {0} could not be 
> accessed","45000"},
>             {"XSDG5","Database is not in create mode when 
> createFinished is called.","45000"},
>             {"XSDG6","Data segment directory not found in {0} backup 
> during restore. Please make sure that backup copy is the right one and 
> it is not corrupted.","45000"},
>             {"XSDG7","Directory {0} could not be removed during 
> restore. Please make sure that permissions are correct.","45000"},
>             {"XSDG8","Unable to copy directory '{0}' to '{1}' during 
> restore. Please make sure that there is enough space and permissions 
> are correct.","45000"},
>             {"XSLA0","Cannot flush the log file to disk {0}.","45000"},
>             {"XSLA1","Log Record has been sent to the stream, but it 
> cannot be applied to the store (Object {0}).  This may cause recovery 
> problems also.","45000"},
>             {"XSLA2","System will shutdown, got I/O Exception while 
> accessing log file.","45000"},
>             {"XSLA3","Log Corrupted, has invalid data in the log 
> stream.","45000"},
>             {"XSLA4","Cannot write to the log, most likely the log is 
> full.  Please delete unnecessary files.  It is also possible that the 
> file system is read only, or the disk has failed, or some other 
> problems with the media.","45000"},
>             {"XSLA5","Cannot read log stream for some reason to 
> rollback transaction {0}.","45000"},
>             {"XSLA6","Cannot recover the database.","45000"},
>             {"XSLA7","Cannot redo operation {0} in the log.","45000"},
>             {"XSLA8","Cannot rollback transaction {0}, trying to 
> compensate {1} operation with {2}","45000"},
>             {"XSLAA","The store has been marked for shutdown by an 
> earlier exception.","45000"},
>             {"XSLAB","Cannot find log file {0}, please make sure your 
> logDevice property is properly set with the correct path separator for 
> your platform.","45000"},
>             {"XSLAC","Database at {0} have incompatible format with 
> the current version of software, it may have been created by or 
> upgraded by a later version.","45000"},
>             {"XSLAD","log Record at instant {2} in log file {3} 
> corrupted. Expected log record length {0}, real length {1}.","45000"},
>             {"XSLAE","Control file at {0} cannot be written or 
> updated.","45000"},
>             {"XSLAF","A Read Only database was created with dirty data 
> buffers.","45000"},
>             {"XSLAH","A Read Only database is being updated.","45000"},
>             {"XSLAI","Cannot log the checkpoint log record","45000"},
>             {"XSLAJ","The logging system has been marked to shut down 
> due to an earlier problem and will not allow any more operations until 
> the system shuts down and restarts.","45000"},
>             {"XSLAK","Database has exceeded largest log file number 
> {0}.","45000"},
>             {"XSLAL","log record size {2} exceeded the maximum 
> allowable log file size {3}. Error encountered in log file {0}, 
> position {1}.","45000"},
>             {"XSLAM","Cannot verify database format at {1} due to 
> IOException.","45000"},
>             {"XSLAN","Database at {0} has an incompatible format with 
> the current version of the software.  The database was created by or 
> upgraded by version {1}.","45000"},
>             {"XSLAO","Recovery failed unexpected problem {0}.","45000"},
>             {"XSLAP","Database at {0} is at version {1}. Beta 
> databases cannot be upgraded,","45000"},
>             {"XSLAQ","cannot create log file at directory {0}.","45000"},
>             {"XSLAR","Unable to copy log file '{0}' to '{1}' during 
> restore. Please make sure that there is enough space and permissions 
> are correct.","45000"},
>             {"XSLAS","Log directory {0} not found in backup during 
> restore. Please make sure that backup copy is the correct one and it 
> is not corrupted.","45000"},
>             {"XSLAT","The log directory '{0}' exists. The directory 
> might belong to another database. Check that the location specified 
> for the logDevice attribute is correct.","45000"},
>             {"XSTB0","An exception was thrown during transaction 
> abort.","50000"},
>             {"XSTB2","Cannot log transaction changes, maybe trying to 
> write to a read only database.","50000"},
>             {"XSTB3","Cannot abort transaction because the log manager 
> is null, probably due to an earlier error.","50000"},
>             {"XSTB5","Creating database with logging disabled 
> encountered unexpected problem.","50000"},
>             {"XSTB6","Cannot substitute a transaction table with 
> another while one is already in use.","50000"},
>             {"XXXXX","Normal database session close.","40000"}};
>
>
>
>
>

Mime
View raw message