Java 8 SQLDataException - 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 SQLDataException class.

This code example shows how to use the following methods:
 * @author Thomas Risberg 
 */ 
public class SQLExceptionSubclassFactory { 
 
	public static SQLException newSQLDataException(String reason, String SQLState, int vendorCode) { 
		return new SQLDataException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLFeatureNotSupportedException(String reason, String SQLState, int vendorCode) { 
		return new SQLFeatureNotSupportedException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLIntegrityConstraintViolationException(String reason, String SQLState, int vendorCode) { 
		return new SQLIntegrityConstraintViolationException(reason, SQLState, vendorCode); 
	} 
 
	public static SQLException newSQLInvalidAuthorizationSpecException(String reason, String SQLState, int vendorCode) { 
		return new SQLInvalidAuthorizationSpecException(reason, SQLState, vendorCode); 
	} 
 
Full Snippet Info
6
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: getCause, getMessage, getErrorCode, getSQLState
 
    /** 
     * @test java.sql.SQLDataException(String, String, int, Throwable) 
     */ 
    public void test_Constructor_LStringLStringILThrowable_23() { 
        SQLDataException sQLDataException = new SQLDataException(null, null,
                -1, null); 
        assertNotNull(sQLDataException);
        assertNull("The SQLState of SQLDataException should be null",
                sQLDataException.getSQLState());
        assertNull("The reason of SQLDataException should be null",
                sQLDataException.getMessage());
        assertEquals("The error code of SQLDataException should be -1",
                sQLDataException.getErrorCode(), -1);
        assertNull("The cause of SQLDataException should be null",
                sQLDataException.getCause());
    } 
 
    /** 
     * @test java.sql.SQLDataException() 
     */ 
Full Snippet Info
5
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
        if (outputClass == null) {
            RowMapper rowMapper = new ColumnMapRowMapper();
            RowMapperResultSetExtractor<Map<String, Object>> mapper = new RowMapperResultSetExtractor<Map<String, Object>>(rowMapper);
            List<Map<String, Object>> data = mapper.extractData(rs);
            if (data.size() > 1) {
                throw new SQLDataException("Query result not unique for outputType=SelectOne. Got " + data.size() +  " count instead.");
            } else if (data.size() == 1) {
                // Set content depend on number of column from query result 
                Map<String, Object> row = data.get(0);
                if (row.size() == 1) {
                    result = row.values().iterator().next();
                } else { 
                    result = row;
                } 
            } 
        } else { 
            Class<?> outputClzz = getCamelContext().getClassResolver().resolveClass(outputClass);
            RowMapper rowMapper = new BeanPropertyRowMapper(outputClzz);
            RowMapperResultSetExtractor<?> mapper = new RowMapperResultSetExtractor(rowMapper);
            List<?> data = mapper.extractData(rs);
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods:
                // (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: 
            // 
            // First, the overview section of java.sql.SQLSyntaxErrorException 
            // 
            // "...thrown when the SQLState class value is '<i>42</i>'" 
Full Snippet Info
4
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
See Code Examples for Java 8 SQLDataException Methods: