Package org.jooq.exception

Examples of org.jooq.exception.DataAccessException


                return connection;
            }
        }

        throw new DataAccessException("Cannot get a JDBC driver connection from configuration: " + configuration);
    }
View Full Code Here


        int i = 0;
        for (String sqlPart : sqlParts) {
            if (sqlPart.matches("\\{\\d+\\}")) {
                if (i == parts.length) {
                    throw new DataAccessException("The number of placeholders must match the number of query parts : " + sql);
                }

                context.sql(parts[i++]);
            }
            else if (sqlPart.matches("\\{[\\w\\s]+\\}")) {
                context.keyword(sqlPart.substring(1, sqlPart.length() - 1));
            }
            else {
                context.sql(sqlPart);
            }
        }

        if (i != parts.length) {
            throw new DataAccessException("The number of placeholders must match the number of query parts : " + sql);
        }
    }
View Full Code Here

            // Only "TOP" support provided by the following dialects.
            // "OFFSET" support is simulated with nested selects
            // -----------------------------------------------------------------
            case DB2: {
                if (offset != null) {
                    throw new DataAccessException("DB2 does not support offsets in FETCH FIRST ROWS ONLY clause");
                }

                // DB2 doesn't allow bind variables here. Casting is not needed.
                context.inline(true)
                       .formatSeparator()
                       .keyword("fetch first ")
                       .sql(numberOfRows)
                       .keyword(" rows only")
                       .inline(inline);

                break;
            }

            case ASE:
            case SQLSERVER: {
                if (offset != null) {
                    throw new DataAccessException("Offsets in TOP clause not supported");
                }

                // SQL Server and Sybase don't allow bind variables in the TOP n clause
                context.inline(true)
                       .keyword("top ")
View Full Code Here

        return result;
    }

    private final DataAccessException onKeyException() {
        return new DataAccessException("Key ambiguous between tables " + lhs + " and " + rhs);
    }
View Full Code Here

            if (cause instanceof RuntimeException) {
                throw (RuntimeException) cause;
            }
            else {
                throw new DataAccessException("Rollback caused", cause);
            }
        }

        return result;
    }
View Full Code Here

    public Cursor<Record> fetchLazy(ResultSet rs) {
        try {
            return fetchLazy(rs, new MetaDataFieldProvider(configuration(), rs.getMetaData()).getFields());
        }
        catch (SQLException e) {
            throw new DataAccessException("Error while accessing ResultSet meta data", e);
        }
    }
View Full Code Here

            }

            return fetchLazy(rs, fields);
        }
        catch (SQLException e) {
            throw new DataAccessException("Error while accessing ResultSet meta data", e);
        }
    }
View Full Code Here

        try {
            data = reader.readAll();
        }
        catch (IOException e) {
            throw new DataAccessException("Could not read the CSV string", e);
        }
        finally {
            try {
                reader.close();
            }
View Full Code Here

            String[] fields = reader.getFields();
            data.add(fields);
            data.addAll(records);
        }
        catch (IOException e) {
            throw new DataAccessException("Could not read the JSON string", e);
        }
        finally {
            try {
                if (reader != null) {
                    reader.close();
View Full Code Here

    /**
     * Translate a {@link SQLException} to a {@link DataAccessException}
     */
    static final DataAccessException translate(String sql, SQLException e) {
        String message = "SQL [" + sql + "]; " + e.getMessage();
        return new DataAccessException(message, e);
    }
View Full Code Here

TOP

Related Classes of org.jooq.exception.DataAccessException

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.