Search in sources :

Example 6 with DataAccessException

use of org.jooq.exception.DataAccessException in project jOOQ by jOOQ.

the class DefaultConnectionProvider method setReadOnly.

/**
     * Convenience method to access {@link Connection#setReadOnly(boolean)}.
     */
public final void setReadOnly(boolean readOnly) throws DataAccessException {
    try {
        log.debug("setting read only", readOnly);
        connection.setReadOnly(readOnly);
    } catch (Exception e) {
        throw new DataAccessException("Cannot set readOnly", e);
    }
}
Also used : DataAccessException(org.jooq.exception.DataAccessException) SQLException(java.sql.SQLException) DataAccessException(org.jooq.exception.DataAccessException)

Example 7 with DataAccessException

use of org.jooq.exception.DataAccessException in project jOOQ by jOOQ.

the class DefaultConnectionProvider method releaseSavepoint.

/**
     * Convenience method to access
     * {@link Connection#releaseSavepoint(Savepoint)}.
     */
public final void releaseSavepoint(Savepoint savepoint) throws DataAccessException {
    try {
        log.debug("release savepoint");
        connection.releaseSavepoint(savepoint);
    } catch (Exception e) {
        throw new DataAccessException("Cannot release savepoint", e);
    }
}
Also used : DataAccessException(org.jooq.exception.DataAccessException) SQLException(java.sql.SQLException) DataAccessException(org.jooq.exception.DataAccessException)

Example 8 with DataAccessException

use of org.jooq.exception.DataAccessException in project jOOQ by jOOQ.

the class DefaultConnectionProvider method setTransactionIsolation.

/**
     * Convenience method to access
     * {@link Connection#setTransactionIsolation(int)}.
     */
public final void setTransactionIsolation(int level) throws DataAccessException {
    try {
        log.debug("setting tx isolation", level);
        connection.setTransactionIsolation(level);
    } catch (Exception e) {
        throw new DataAccessException("Cannot set transactionIsolation", e);
    }
}
Also used : DataAccessException(org.jooq.exception.DataAccessException) SQLException(java.sql.SQLException) DataAccessException(org.jooq.exception.DataAccessException)

Example 9 with DataAccessException

use of org.jooq.exception.DataAccessException in project jOOQ by jOOQ.

the class DefaultConnectionProvider method setAutoCommit.

/**
     * Convenience method to access {@link Connection#setAutoCommit(boolean)}.
     */
public final void setAutoCommit(boolean autoCommit) throws DataAccessException {
    try {
        log.debug("setting auto commit", autoCommit);
        connection.setAutoCommit(autoCommit);
    } catch (Exception e) {
        throw new DataAccessException("Cannot set autoCommit", e);
    }
}
Also used : DataAccessException(org.jooq.exception.DataAccessException) SQLException(java.sql.SQLException) DataAccessException(org.jooq.exception.DataAccessException)

Example 10 with DataAccessException

use of org.jooq.exception.DataAccessException in project jOOQ by jOOQ.

the class DefaultDSLContext method fetchFromCSV.

@Override
public Result<Record> fetchFromCSV(String string, boolean header, char delimiter) {
    CSVReader reader = new CSVReader(new StringReader(string), delimiter);
    List<String[]> list = null;
    try {
        list = reader.readAll();
    } catch (IOException e) {
        throw new DataAccessException("Could not read the CSV string", e);
    } finally {
        try {
            reader.close();
        } catch (IOException ignore) {
        }
    }
    return fetchFromStringData(list, header);
}
Also used : CSVReader(org.jooq.tools.csv.CSVReader) StringReader(java.io.StringReader) IOException(java.io.IOException) DataAccessException(org.jooq.exception.DataAccessException)

Aggregations

DataAccessException (org.jooq.exception.DataAccessException)34 SQLException (java.sql.SQLException)14 Test (org.junit.Test)5 ExceptionMetered (com.codahale.metrics.annotation.ExceptionMetered)4 Timed (com.codahale.metrics.annotation.Timed)4 Connection (java.sql.Connection)4 Consumes (javax.ws.rs.Consumes)4 POST (javax.ws.rs.POST)4 Event (keywhiz.log.Event)4 SecretController (keywhiz.service.daos.SecretController)4 ConflictException (keywhiz.service.exceptions.ConflictException)4 IOException (java.io.IOException)3 SQLSyntaxErrorException (java.sql.SQLSyntaxErrorException)3 HashMap (java.util.HashMap)3 Response (javax.ws.rs.core.Response)3 SanitizedSecret (keywhiz.api.model.SanitizedSecret)3 Secret (keywhiz.api.model.Secret)3 StringReader (java.io.StringReader)2 URI (java.net.URI)2 Savepoint (java.sql.Savepoint)2