Examples of JdbcSQLException


Examples of org.h2.jdbc.JdbcSQLException

     * @param e the root cause
     * @return the IO exception
     */
    public static IOException convertToIOException(Throwable e) {
        if (e instanceof JdbcSQLException) {
            JdbcSQLException e2 = (JdbcSQLException) e;
            if (e2.getOriginalCause() != null) {
                e = e2.getOriginalCause();
            }
        }
        IOException io = new IOException(e.toString());
        //## Java 1.4 begin ##
        io.initCause(e);
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

            String sqlstate = transfer.readString();
            String message = transfer.readString();
            String sql = transfer.readString();
            int errorCode = transfer.readInt();
            String stackTrace = transfer.readString();
            JdbcSQLException s = new JdbcSQLException(message, sql, sqlstate, errorCode, null, stackTrace);
            if (errorCode == ErrorCode.CONNECTION_BROKEN_1) {
                // allow re-connect
                IOException e = new IOException(s.toString());
                e.initCause(s);
                throw e;
            }
            throw DbException.convert(s);
        } else if (status == STATUS_CLOSED) {
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

    @Override
    public DataAccessException translateExceptionIfPossible(RuntimeException re) {       
        DataAccessException e = null;
        // first make sure the root exception is actually an org.h2.jdbc.JdbcSQLException
        if (ExceptionUtils.getRootCause(re) instanceof JdbcSQLException) {
            JdbcSQLException rootException = (JdbcSQLException)ExceptionUtils.getRootCause(re);
                       
            // now translate the H2 specific error codes into Rave's common application Exceptions
            // add more error codes to the switch statement that should be specifically trapped                        
            switch(rootException.getErrorCode()) {
                case ErrorCode.DUPLICATE_KEY_1: {
                    e = new DuplicateItemException("DUPLICATE_ITEM", rootException);
                    break;
                }

                default: {
                    e = new TranslatedH2Exception(rootException.getErrorCode(), "ERROR", "Unknown Database Error");
                    break;
                }
            }
        } else {           
            // we got a RuntimeException that wasn't an org.h2.jdbc.JdbcSQLException
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

     * @return the exception
     */
    public DbException addSQL(String sql) {
        SQLException e = getSQLException();
        if (e instanceof JdbcSQLException) {
            JdbcSQLException j = (JdbcSQLException) e;
            if (j.getSQL() == null) {
                j.setSQL(sql);
            }
            return this;
        }
        e = new JdbcSQLException(e.getMessage(), sql, e.getSQLState(), e.getErrorCode(), e, null);
        return new DbException(e);
    }
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

     * @return the SQLException object
     */
    private static JdbcSQLException getJdbcSQLException(int errorCode, Throwable cause, String... params) {
        String sqlstate = ErrorCode.getState(errorCode);
        String message = translate(sqlstate, params);
        return new JdbcSQLException(message, null, sqlstate, errorCode, cause, null);
    }
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

    public static IOException convertToIOException(Throwable e) {
        if (e instanceof IOException) {
            return (IOException) e;
        }
        if (e instanceof JdbcSQLException) {
            JdbcSQLException e2 = (JdbcSQLException) e;
            if (e2.getOriginalCause() != null) {
                e = e2.getOriginalCause();
            }
        }
        IOException io = new IOException(e.toString());
        io.initCause(e);
        return io;
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

                return;
            }
            printWriter.println(s);
            if (t != null) {
                if (levelFile == ERROR && t instanceof JdbcSQLException) {
                    JdbcSQLException se = (JdbcSQLException) t;
                    int code = se.getErrorCode();
                    if (ErrorCode.isCommon(code)) {
                        printWriter.println(t.toString());
                    } else {
                        t.printStackTrace(printWriter);
                    }
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

            e.printStackTrace(new PrintWriter(writer));
            String trace = writer.toString();
            String message;
            String sql;
            if (e instanceof JdbcSQLException) {
                JdbcSQLException j = (JdbcSQLException) e;
                message = j.getOriginalMessage();
                sql = j.getSQL();
            } else {
                message = e.getMessage();
                sql = null;
            }
            transfer.writeInt(SessionRemote.STATUS_ERROR).writeString(e.getSQLState()).writeString(message)
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

     * @return the exception
     */
    public DbException addSQL(String sql) {
        SQLException e = getSQLException();
        if (e instanceof JdbcSQLException) {
            JdbcSQLException j = (JdbcSQLException) e;
            if (j.getSQL() == null) {
                j.setSQL(sql);
            }
            return this;
        }
        e = new JdbcSQLException(e.getMessage(), sql, e.getSQLState(), e.getErrorCode(), e, null);
        return new DbException(e);
    }
View Full Code Here

Examples of org.h2.jdbc.JdbcSQLException

     * @return the SQLException object
     */
    private static JdbcSQLException getJdbcSQLException(int errorCode, Throwable cause, String... params) {
        String sqlstate = ErrorCode.getState(errorCode);
        String message = translate(sqlstate, params);
        return new JdbcSQLException(message, null, sqlstate, errorCode, cause, null);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.