Package java.sql

Examples of java.sql.SQLNonTransientConnectionException


            ex = new SQLException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.CONNECTIVITY_PREFIX) ||
            errCode >= ExceptionSeverity.SESSION_SEVERITY) {
            //none of the sqlstate supported by derby belongs to
            //TransientConnectionException. DERBY-3075
            ex = new SQLNonTransientConnectionException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.SQL_DATA_PREFIX)) {
            ex = new SQLDataException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.INTEGRITY_VIOLATION_PREFIX)) {
            ex = new SQLIntegrityConstraintViolationException(message, sqlState,
                    errCode);
View Full Code Here


        final SQLException ex;
        if (sqlState.startsWith(SQLState.CONNECTIVITY_PREFIX)) {
            //no derby sqlstate belongs to
            //TransientConnectionException DERBY-3074
            ex = new SQLNonTransientConnectionException(message, sqlState, severity, t);
        } else if (sqlState.startsWith(SQLState.SQL_DATA_PREFIX)) {
            ex = new SQLDataException(message, sqlState, severity, t);
        } else if (sqlState.startsWith(SQLState.INTEGRITY_VIOLATION_PREFIX)) {
            ex = new SQLIntegrityConstraintViolationException(message, sqlState,
                    severity, t);
View Full Code Here

        if (sqlState == null) {
            ex = new SQLException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.CONNECTIVITY_PREFIX)) {
            //none of the sqlstate supported by derby belongs to
            //TransientConnectionException. DERBY-3075
            ex = new SQLNonTransientConnectionException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.SQL_DATA_PREFIX)) {
            ex = new SQLDataException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.INTEGRITY_VIOLATION_PREFIX)) {
            ex = new SQLIntegrityConstraintViolationException(message, sqlState,
                    errCode);
        } else if (sqlState.startsWith(SQLState.AUTHORIZATION_SPEC_PREFIX)) {
            ex = new SQLInvalidAuthorizationSpecException(message, sqlState,
                    errCode);
        } else if (sqlState.startsWith(SQLState.TRANSACTION_PREFIX)) {
            ex = new SQLTransactionRollbackException(message, sqlState,
                    errCode);
        } else if (sqlState.startsWith(SQLState.LSE_COMPILATION_PREFIX)) {
            ex = new SQLSyntaxErrorException(message, sqlState, errCode);
        } else if (
            sqlState.startsWith (SQLState.UNSUPPORTED_PREFIX)   ||
            sqlState.equals(DRDA_COMMAND_NOT_SUPPORTED)         ||
            sqlState.equals(DRDA_OBJECT_NOT_SUPPORTED)          ||
            sqlState.equals(DRDA_PARAM_NOT_SUPPORTED)           ||
            sqlState.equals(DRDA_VALUE_NOT_SUPPORTED)           ||
            sqlState.equals(DRDA_SQLTYPE_NOT_SUPPORTED)         ||
            sqlState.equals(DRDA_REPLY_MSG_NOT_SUPPORTED)           ) {
            ex = new SQLFeatureNotSupportedException(message, sqlState,
                    errCode);
        } else if
                (
                 sqlState.equals(SQLState.LANG_STATEMENT_CANCELLED_OR_TIMED_OUT.substring(0, 5)) ||
                 sqlState.equals(SQLState.LOGIN_TIMEOUT.substring(0, 5))
                 ) {
            ex = new SQLTimeoutException(message, sqlState, errCode);
        }
        // If the sub-class cannot be determined based on the SQLState, use
        // the severity instead.
        else if (errCode >= ExceptionSeverity.SESSION_SEVERITY) {
            ex = new SQLNonTransientConnectionException(
                    message, sqlState, errCode);
        } else if (errCode >= ExceptionSeverity.TRANSACTION_SEVERITY) {
            ex = new SQLTransactionRollbackException(
                    message, sqlState, errCode);
        }
View Full Code Here

            ex = new SQLException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.CONNECTIVITY_PREFIX) ||
            errCode >= ExceptionSeverity.SESSION_SEVERITY) {
            //none of the sqlstate supported by derby belongs to
            //TransientConnectionException. DERBY-3075
            ex = new SQLNonTransientConnectionException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.SQL_DATA_PREFIX)) {
            ex = new SQLDataException(message, sqlState, errCode);
        } else if (sqlState.startsWith(SQLState.INTEGRITY_VIOLATION_PREFIX)) {
            ex = new SQLIntegrityConstraintViolationException(message, sqlState,
                    errCode);
View Full Code Here

        final SQLException ex;
        if (sqlState.startsWith(SQLState.CONNECTIVITY_PREFIX)) {
            //none of the sqlstate supported by derby belongs to
            //TransientConnectionException DERBY-3074
            ex = new SQLNonTransientConnectionException(message, sqlState,
                    severity, t);
        } else if (sqlState.startsWith(SQLState.SQL_DATA_PREFIX)) {
            ex = new SQLDataException(message, sqlState, severity, t);
        } else if (sqlState.startsWith(SQLState.INTEGRITY_VIOLATION_PREFIX)) {
            ex = new SQLIntegrityConstraintViolationException(message, sqlState,
View Full Code Here

                        code, cause);
            } else {

                // the database is (permanently) shut down or the connection is
                // (permanently) closed or broken
                return new SQLNonTransientConnectionException(msg, sqlstate,
                        code, cause);
            }
        } else if (sqlstate.startsWith("22")) {
            return new SQLDataException(msg, sqlstate, code, cause);
        } else if (sqlstate.startsWith("23")) {
View Full Code Here

     * @test java.sql.SQLNonTransientConnectionException(String, String,
     *       Throwable)
     */
    public void test_Constructor_LStringLStringLThrowable() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
                "MYTESTSTRING1", "MYTESTSTRING2", cause);
        assertNotNull(sQLNonTransientConnectionException);
        assertEquals(
                "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
                "MYTESTSTRING2", sQLNonTransientConnectionException
                        .getSQLState());
        assertEquals(
                "The reason of SQLNonTransientConnectionException set and get should be equivalent",
                "MYTESTSTRING1", sQLNonTransientConnectionException
                        .getMessage());
        assertEquals(
                "The error code of SQLNonTransientConnectionException should be 0",
                sQLNonTransientConnectionException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLNonTransientConnectionException set and get should be equivalent",
                cause, sQLNonTransientConnectionException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientConnectionException(String, String,
     *       Throwable)
     */
    public void test_Constructor_LStringLStringLThrowable_1() {
        SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
                "MYTESTSTRING1", "MYTESTSTRING2", null);
        assertNotNull(sQLNonTransientConnectionException);
        assertEquals(
                "The SQLState of SQLNonTransientConnectionException set and get should be equivalent",
                "MYTESTSTRING2", sQLNonTransientConnectionException
                        .getSQLState());
        assertEquals(
                "The reason of SQLNonTransientConnectionException set and get should be equivalent",
                "MYTESTSTRING1", sQLNonTransientConnectionException
                        .getMessage());
        assertEquals(
                "The error code of SQLNonTransientConnectionException should be 0",
                sQLNonTransientConnectionException.getErrorCode(), 0);
        assertNull(
                "The cause of SQLNonTransientConnectionException should be null",
                sQLNonTransientConnectionException.getCause());
    }
View Full Code Here

     * @test java.sql.SQLNonTransientConnectionException(String, String,
     *       Throwable)
     */
    public void test_Constructor_LStringLStringLThrowable_2() {
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
                "MYTESTSTRING", null, cause);
        assertNotNull(sQLNonTransientConnectionException);
        assertNull(
                "The SQLState of SQLNonTransientConnectionException should be null",
                sQLNonTransientConnectionException.getSQLState());
        assertEquals(
                "The reason of SQLNonTransientConnectionException set and get should be equivalent",
                "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
        assertEquals(
                "The error code of SQLNonTransientConnectionException should be 0",
                sQLNonTransientConnectionException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLNonTransientConnectionException set and get should be equivalent",
                cause, sQLNonTransientConnectionException.getCause());
    }
View Full Code Here

    /**
     * @test java.sql.SQLNonTransientConnectionException(String, String,
     *       Throwable)
     */
    public void test_Constructor_LStringLStringLThrowable_3() {
        SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
                "MYTESTSTRING", null, null);
        assertNotNull(sQLNonTransientConnectionException);
        assertNull(
                "The SQLState of SQLNonTransientConnectionException should be null",
                sQLNonTransientConnectionException.getSQLState());
        assertEquals(
                "The reason of SQLNonTransientConnectionException set and get should be equivalent",
                "MYTESTSTRING", sQLNonTransientConnectionException.getMessage());
        assertEquals(
                "The error code of SQLNonTransientConnectionException should be 0",
                sQLNonTransientConnectionException.getErrorCode(), 0);
        assertNull(
                "The cause of SQLNonTransientConnectionException should be null",
                sQLNonTransientConnectionException.getCause());
    }
View Full Code Here

TOP

Related Classes of java.sql.SQLNonTransientConnectionException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.