Examples of BadSqlGrammarException


Examples of org.springframework.jdbc.BadSqlGrammarException

    // 10 - semantic analysis
    case 10:
      return new DataRetrievalFailureException(cause, ex);
      // 11 - parse error
    case 11:
      return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
      // 12 - Internal error
    case 12:
      return new NonTransientDataAccessResourceException(cause, ex);
      // -10000 - another internal error
    case -10000:
      return new NonTransientDataAccessResourceException(cause, ex);
    }

    // look at the SQL code

    if ("08S01".equals(sqlState)) {
      // internal error
      return new NonTransientDataAccessResourceException(cause, ex);
    }
    // generic syntax error
    else if ("42000".equals(sqlState)) {
      return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
    }
    // not found/already exists
    else if ("42S02".equals(sqlState)) {
      return new InvalidDataAccessResourceUsageException(cause, ex);
    }
    // invalid argument
    else if ("21000".equals(sqlState)) {
      return new BadSqlGrammarException("Hive query", "", new SQLException(cause, sqlState));
    }

    // use the new Hive 0.10 codes
    // https://issues.apache.org/jira/browse/HIVE-3001
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

    //documents
    final Document document1 = new Document();
    document1.add(new Field("contents", "test_name", Field.Store.NO, Field.Index.TOKENIZED));
   
    //exception
    BadSqlGrammarException ex = new BadSqlGrammarException("arg1", "arg2", null);

    indexFactory.getIndexWriter();
    indexFactoryControl.setReturnValue(indexWriter, 1);
   
    listener.beforeIndexingRequest(request1);
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

    }
    String sqlState = getSqlState(ex);
    if (sqlState != null && sqlState.length() >= 2) {
      String classCode = sqlState.substring(0, 2);
      if (BAD_SQL_CODES.contains(classCode)) {
        return new BadSqlGrammarException(task, sql, ex);
      }
      else if (INTEGRITY_VIOLATION_CODES.contains(classCode)) {
        return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
      }
      else if (RESOURCE_FAILURE_CODES.contains(classCode)) {
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

        }

        // Next, look for grouped error codes.
        if (Arrays.binarySearch(this.sqlErrorCodes.getBadSqlGrammarCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new BadSqlGrammarException(task, sql, sqlExToUse);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getInvalidResultSetAccessCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new InvalidResultSetAccessException(task, sql, sqlExToUse);
        }
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

    }
    String sqlState = getSqlState(ex);
    if (sqlState != null && sqlState.length() >= 2) {
      String classCode = sqlState.substring(0, 2);
      if (BAD_SQL_CODES.contains(classCode)) {
        return new BadSqlGrammarException(task, sql, ex);
      }
      else if (INTEGRITY_VIOLATION_CODES.contains(classCode)) {
        return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
      }
      else if (RESOURCE_FAILURE_CODES.contains(classCode)) {
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

        }

        // Next, look for grouped error codes.
        if (Arrays.binarySearch(this.sqlErrorCodes.getBadSqlGrammarCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new BadSqlGrammarException(task, sql, sqlExToUse);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getInvalidResultSetAccessCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlExToUse, false);
          return new InvalidResultSetAccessException(task, sql, sqlExToUse);
        }
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

    compiled = true;
   
    for (SqlParameter callParameter : callParameters){
      if (!logicalParametersIterator.hasNext()){
        // Metadata has more parameters than were passed
        throw new BadSqlGrammarException("JDBC Call", this.getCallString(), new SQLException("Not enough parameters provided."));
      }
     
      // The logical name is the name this parameter is known as to a client
      logicalParameter = logicalParametersIterator.next();
     
      // Map the database parameter name to the logical parameter and the logical
      // parameter name to the db name
      dbNameToLogicalParameterMap.put(callParameter.getName(), logicalParameter);
      logicalNameToDbNameMap.put(logicalParameter.getName(), callParameter.getName());
     
      // If this is an IN or IN/OUT parameter, map the database name to
      // the value supplied by the client.  Calls convertInputValue to
      // give subclasses a chance to convert the provided input value.
      if (callParameter.isInputValueProvided()){
        if (logicalParameter instanceof NamedSqlParameterValue){
          value = convertInputValue(callParameter, ((NamedSqlParameterValue)logicalParameter).getValue());
        }else if (logicalParameter instanceof SqlParameterValue){
          value = convertInputValue(callParameter, ((SqlParameterValue)logicalParameter).getValue());
        }else{
          value = null;
        }
       
        dbNameToValueMap.put(callParameter.getName(), value);
      }
     
      index++;
    }
   
    if (logicalParametersIterator.hasNext()){
      // More parameters were passed than exist in the meta data
      throw new BadSqlGrammarException("JDBC Call", this.getCallString(), new SQLException("Too many parameters provided."));
    }
  }
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

      String classCode = sqlState.substring(0, 2);
      if (logger.isDebugEnabled()) {
        logger.debug("Extracted SQL state class '" + classCode + "' from value '" + sqlState + "'");
      }
      if (BAD_SQL_GRAMMAR_CODES.contains(classCode)) {
        return new BadSqlGrammarException(task, sql, ex);
      }
      else if (DATA_INTEGRITY_VIOLATION_CODES.contains(classCode)) {
        return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
      }
      else if (DATA_ACCESS_RESOURCE_FAILURE_CODES.contains(classCode)) {
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

          }
        }
        // Next, look for grouped error codes.
        if (Arrays.binarySearch(this.sqlErrorCodes.getBadSqlGrammarCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlEx, false);
          return new BadSqlGrammarException(task, sql, sqlEx);
        }
        else if (Arrays.binarySearch(this.sqlErrorCodes.getInvalidResultSetAccessCodes(), errorCode) >= 0) {
          logTranslation(task, sql, sqlEx, false);
          return new InvalidResultSetAccessException(task, sql, sqlEx);
        }
View Full Code Here

Examples of org.springframework.jdbc.BadSqlGrammarException

      }
      else if (ex instanceof SQLNonTransientConnectionException) {
        return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
      }
      else if (ex instanceof SQLSyntaxErrorException) {
        return new BadSqlGrammarException(task, sql, ex);
      }
    }
    else if (ex instanceof SQLRecoverableException) {
      return new RecoverableDataAccessException(buildMessage(task, sql, ex), ex);
    }
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.