Java 8 SQLNonTransientConnectionException - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 SQLNonTransientConnectionException class.

This code example shows how to use the following methods:
	public static SQLException newSQLInvalidAuthorizationSpecException(String reason, String SQLState, int vendorCode) { 
		return new SQLInvalidAuthorizationSpecException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLNonTransientConnectionException(String reason, String SQLState, int vendorCode) { 
		return new SQLNonTransientConnectionException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLSyntaxErrorException(String reason, String SQLState, int vendorCode) { 
		return new SQLSyntaxErrorException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLTransactionRollbackException(String reason, String SQLState, int vendorCode) { 
		return new SQLTransactionRollbackException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLTransientConnectionException(String reason, String SQLState, int vendorCode) { 
		return new SQLTransientConnectionException(reason, SQLState, vendorCode); 
	} 
 
6
CodeRank
This code example shows how to use the following methods:getMessage, getSQLState
        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()));
5
CodeRank
This code example shows how to use the following methods:getCause, getMessage, getErrorCode, getSQLState
    /** 
     * @test java.sql.SQLNonTransientConnectionException(Throwable) 
     */ 
    public void test_Constructor_LThrowable() { 
        Throwable cause = new Exception("MYTHROWABLE");
        SQLNonTransientConnectionException sQLNonTransientConnectionException = new SQLNonTransientConnectionException(
                cause);
        assertNotNull(sQLNonTransientConnectionException);
        assertEquals(
                "The reason of SQLNonTransientConnectionException should be equals to cause.toString()", 
                "java.lang.Exception: MYTHROWABLE", 
                sQLNonTransientConnectionException.getMessage());
        assertNull(
                "The SQLState of SQLNonTransientConnectionException should be null", 
                sQLNonTransientConnectionException.getSQLState());
        assertEquals(
                "The error code of SQLNonTransientConnectionException should be 0", 
                sQLNonTransientConnectionException.getErrorCode(), 0);
        assertEquals(
                "The cause of SQLNonTransientConnectionException set and get should be equivalent", 

5
CodeRank
This code example shows how to use the following methods:
                        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")) {
            return new SQLIntegrityConstraintViolationException(msg, sqlstate,
                    code, cause);
        } else if (sqlstate.startsWith("28")) {
            return new SQLInvalidAuthorizationSpecException(msg, sqlstate,
                    code, cause);
        } else if (sqlstate.startsWith("42") || sqlstate.startsWith("37")
                   || sqlstate.startsWith("2A")) {
 
            // TODO: 
4
CodeRank
This code example shows how to use the following methods:
                    String cypherPath = discovery.getCypherPath();
 
                    cypherResource = resources.getCypherResource(cypherPath);
                } catch (IOException e)
                { 
                    throw new SQLNonTransientConnectionException(e);
                } 
    } 
 
    public ExecutionResult executeQuery(String query, Map<String, Object> parameters) throws SQLException {
        final ClientResource resource = new ClientResource(cypherResource);
        try { 
            ObjectNode queryNode = queryParameter(query, parameters);
            Representation rep = resource.post(queryNode.toString());
            rep.setCharacterSet(new CharacterSet("UTF-8"));
            JsonNode node = mapper.readTree(rep.getReader());
            final ResultParser parser = new ResultParser(node);
            return new ExecutionResult(parser.getColumns(), parser.streamData());
        } catch (ResourceException e) {
            String msg=extractErrorMessage(resource);
3
CodeRank
See Code Examples for Java 8 SQLNonTransientConnectionException Methods: