Code example for SQLNonTransientConnectionException

Methods: getMessagegetSQLState

0
        String url = getUrl() + ";shutdown=true";
 
        try { 
            DriverManager.getConnection(url);
        } catch (SQLNonTransientConnectionException e) {
            if ("08006".equals(e.getSQLState())) {
                log.debug(e.getMessage());
            } else { 
                log.error(e.getMessage(), e);
            } 
        } 
    } 
 
     
    /** 
     * Stop writes to the database to allow copying.  
     */ 
    public void freeze() { 
         
        log.debug(String.format("Freezing database [%s]", getUrl()));
Experience pair programming with AI  Get Codota for Java