Java JDBC Connection Create internalShutdown(String connectionString, int expectedErrorCode, String expectedSQLState)

Here you can find the source of internalShutdown(String connectionString, int expectedErrorCode, String expectedSQLState)

Description

internal Shutdown

License

Open Source License

Declaration

private static void internalShutdown(String connectionString, int expectedErrorCode, String expectedSQLState)
            throws SQLException 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.sql.DriverManager;
import java.sql.SQLException;

public class Main {
    private static void internalShutdown(String connectionString, int expectedErrorCode, String expectedSQLState)
            throws SQLException {

        try {//w w w.  ja  v a  2s . c o  m

            DriverManager.getConnection(connectionString);

        } catch (SQLException ex) {

            boolean successfullShutdown = expectedErrorCode == ex.getErrorCode()
                    && expectedSQLState.equals(ex.getSQLState());

            if (!successfullShutdown) {
                throw ex;
            }

        }

    }
}

Related

  1. getTargetConnection()
  2. getTestDBConnection()
  3. getTRECConnection()
  4. getUrlConnection()
  5. getUserConnection()
  6. runSQLExecute(String sql, Map config)