Package java.sql

Examples of java.sql.SQLException


import java.sql.SQLException;

public class _SQLException {
  public static SQLException createNewInstance(Throwable t){
    SQLException sql = new SQLException();
    sql.initCause(t);
    return sql;
  }
View Full Code Here


                }
                else {
                    if (getLastException() != null) {
                                                       
                  String msg = "NA";
                   SQLException s = getLastException();
                  
                   Throwable t = s.getCause();
                   if (t instanceof TimeoutException) {
                      msg = t.getMessage();
                   } else if (s instanceof TeiidSQLException) {
                      TeiidSQLException mm = (TeiidSQLException) t;
                        if (mm.getNextException() != null) {
                      SQLException next = mm.getNextException();
                      msg = next.getMessage();
                        } else {
                      msg = mm.getMessage();
                        }
                   } else {
                  
View Full Code Here

    Channels.write(this.ctx, this.message.getFuture(), buffer, this.message.getRemoteAddress());   
  }
 
  private void sendErrorResponse(Throwable t) throws IOException {
    trace(t.getMessage());
    SQLException e = TeiidSQLException.create(t);
    startMessage('E');
    write('S');
    writeString("ERROR");
    write('C');
    writeString(e.getSQLState());
    write('M');
    writeString(e.getMessage());
    write('D');
    writeString(e.toString());
    write(0);
    sendMessage();
  }
View Full Code Here

    if (password != null) {
      info.setProperty(TeiidURL.CONNECTION.PASSWORD, password);
    }
    Connection c = TeiidDriver.getInstance().connect(url, info);
    if (c == null) {
      throw new SQLException("Invalid url " + url);
    }
    return new TeiidSql(c);
  }
View Full Code Here

          case BYTE_ARRAY :
          case SERIALIZABLE :
            stmt.bindBlob(i + 1, (byte[]) arg);
            break;
          default :
            throw new SQLException("Unknown sql argument type " + argFieldTypes[i].getSqlType());
        }
      }
    }
  }
View Full Code Here

    return cursor;
  }

  private void isInPrep() throws SQLException {
    if (cursor != null) {
      throw new SQLException("Query already run. Cannot add argument values.");
    }
  }
View Full Code Here

    public static Connection getConnection(boolean sharable) throws SQLException {
        try {
            return DBAccessorFactory.create().getConnection(sharable);
        } catch (Exception e) {
            throw new SQLException("Exception caused while create connection");
        }
    }
View Full Code Here

            return Collections.EMPTY_MAP; // immutable
        }
        do {
            Object key = rs.getObject(keyIndex);
            if(key == null) { // sanity check
                throw new SQLException("key value is not found: " + keyIndex);
            }
            retMap.put(key, rs.getObject(valueIndex));
        } while(rs.next());
        return retMap;
    }
View Full Code Here

   
    private TeiidSQLException(SQLException ex, String message, boolean addChildren) {
        super(message, ex.getSQLState() == null ? SQLStates.DEFAULT : ex.getSQLState(), ex.getErrorCode());
       
        if (addChildren) {
          SQLException childException = ex; // this a child to the SQLException constructed from reason

            while (childException != null) {
                if (childException instanceof TeiidSQLException) {
                    super.setNextException(ex);
                    break;
                }
                super.setNextException(new TeiidSQLException(childException, getMessage(childException, null),false));
                childException = childException.getNextException();
            }
        }
    }   
View Full Code Here

    return result;
  }
 
  ConnectionImpl getConnectionImpl() throws SQLException {
      if(isClosed){
            throw new SQLException(JDBCPlugin.Util.getString("MMXAConnection.connection_is_closed")); //$NON-NLS-1$
        }
       
        if(connection == null){
            try{
                connection = cs.createConnection();
View Full Code Here

TOP

Related Classes of java.sql.SQLException

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.