java.sql.SQLFeatureNotSupportedException Java Examples

The following examples show how to use java.sql.SQLFeatureNotSupportedException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DremioDatabaseMetaDataImpl.java    From dremio-oss with Apache License 2.0 6 votes vote down vote up
@Override
public boolean ownUpdatesAreVisible(int type) throws SQLException {
  throwIfClosed();
  try {
    return super.ownUpdatesAreVisible(type);
  }
  catch (RuntimeException e) {
    if ("todo: implement this method".equals(e.getMessage())) {
      throw new SQLFeatureNotSupportedException(
          "ownUpdatesAreVisible(int) is not supported", e);
    }
    else {
      throw new SQLException(e.getMessage(), e);
    }
  }
}
 
Example #2
Source File: StatementIT.java    From snowflake-jdbc with Apache License 2.0 6 votes vote down vote up
/**
 * Test Autogenerated key.
 *
 * @throws Throwable if any error occurs
 */
@Test
public void testAutogenerateKey() throws Throwable
{
  try (Connection connection = getConnection())
  {
    Statement statement = connection.createStatement();
    statement.execute("create or replace table t(c1 int)");
    statement.execute("insert into t values(1)", Statement.NO_GENERATED_KEYS);
    try
    {
      statement.execute("insert into t values(2)", Statement.RETURN_GENERATED_KEYS);
      fail("no autogenerate key is supported");
    }
    catch (SQLFeatureNotSupportedException ex)
    {
      // nop
    }
    // empty result
    ResultSet rset = statement.getGeneratedKeys();
    assertFalse(rset.next());
    rset.close();
  }
}
 
Example #3
Source File: PhoenixRuntime.java    From phoenix with Apache License 2.0 6 votes vote down vote up
/**
 * Get expression that may be used to evaluate the tenant ID of a given row in a
 * multi-tenant table. Both the SYSTEM.CATALOG table and the SYSTEM.SEQUENCE
 * table are considered multi-tenant.
 * @param conn open Phoenix connection
 * @param fullTableName full table name
 * @return An expression that may be evaluated for a row in the provided table or
 * null if the table is not a multi-tenant table. 
 * @throws SQLException if the table name is not found, a TableNotFoundException
 * is thrown. If a multi-tenant local index is supplied a SQLFeatureNotSupportedException
 * is thrown.
 */
public static Expression getTenantIdExpression(Connection conn, String fullTableName) throws SQLException {
    PTable table = getTable(conn, fullTableName);
    // TODO: consider setting MULTI_TENANT = true for SYSTEM.CATALOG and SYSTEM.SEQUENCE
    if (!SchemaUtil.isMetaTable(table) && !SchemaUtil.isSequenceTable(table) && !table.isMultiTenant()) {
        return null;
    }
    if (table.getIndexType() == IndexType.LOCAL) {
        /*
         * With some hackery, we could deduce the tenant ID from a multi-tenant local index,
         * however it's not clear that we'd want to maintain the same prefixing of the region
         * start key, as the region boundaries may end up being different on a cluster being
         * replicated/backed-up to (which is the use case driving the method).
         */
        throw new SQLFeatureNotSupportedException();
    }
    
    int pkPosition = table.getBucketNum() == null ? 0 : 1;
    List<PColumn> pkColumns = table.getPKColumns();
    return new RowKeyColumnExpression(pkColumns.get(pkPosition), new RowKeyValueAccessor(pkColumns, pkPosition));
}
 
Example #4
Source File: UpdateResultSetMethodsTest.java    From mariadb-connector-j with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testupdateNClob70() {
  try {
    rs.updateNClob(1, (java.sql.NClob) null);
  } catch (SQLFeatureNotSupportedException sqle) {
    Assert.fail();
  } catch (SQLException sqlee) {
    // eat
  }
}
 
Example #5
Source File: ResultSetTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
public void testUpdateNClobStringNotImplemented()
    throws SQLException {
    try {
        rs.updateNClob("some-column-name", (NClob)null);
        fail("ResultSet.updateNClob(String, NClob) " +
             "should not be implemented");
    } catch (SQLFeatureNotSupportedException sfnse) {
        // We are fine, do nothing.
    }
}
 
Example #6
Source File: SnowflakeBaseResultSet.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
@Override
public boolean previous() throws SQLException
{
  logger.debug("public boolean previous()");

  throw new SQLFeatureNotSupportedException();
}
 
Example #7
Source File: SQLFeatureNotSupportedExceptionTests.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create SQLFeatureNotSupportedException with message, SQLState, errorCode, and Throwable
 */
@Test
public void test5() {
    SQLFeatureNotSupportedException ex =
            new SQLFeatureNotSupportedException(reason, state, errorCode, t);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && cause.equals(ex.getCause().toString())
            && ex.getErrorCode() == errorCode);
}
 
Example #8
Source File: ResultSetTest.java    From spliceengine with GNU Affero General Public License v3.0 5 votes vote down vote up
public void testUpdateNClobStringLengthlessNotImplemented()
    throws SQLException {
    try {
        rs.updateNClob("some-column-name", (Reader)null);
        fail("ResultSet.updateNClob(String, Reader) " +
             "should not be implemented");
    } catch (SQLFeatureNotSupportedException sfnse) {
        // We are fine, do nothing.
    }
}
 
Example #9
Source File: SQLExceptionSubclassTranslator.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
@Override
protected DataAccessException doTranslate(String task, String sql, SQLException ex) {
	if (ex instanceof SQLTransientException) {
		if (ex instanceof SQLTransientConnectionException) {
			return new TransientDataAccessResourceException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLTransactionRollbackException) {
			return new ConcurrencyFailureException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLTimeoutException) {
			return new QueryTimeoutException(buildMessage(task, sql, ex), ex);
		}
	}
	else if (ex instanceof SQLNonTransientException) {
		if (ex instanceof SQLNonTransientConnectionException) {
			return new DataAccessResourceFailureException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLDataException) {
			return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLIntegrityConstraintViolationException) {
			return new DataIntegrityViolationException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLInvalidAuthorizationSpecException) {
			return new PermissionDeniedDataAccessException(buildMessage(task, sql, ex), ex);
		}
		else if (ex instanceof SQLSyntaxErrorException) {
			return new BadSqlGrammarException(task, sql, ex);
		}
		else if (ex instanceof SQLFeatureNotSupportedException) {
			return new InvalidDataAccessApiUsageException(buildMessage(task, sql, ex), ex);
		}
	}
	else if (ex instanceof SQLRecoverableException) {
		return new RecoverableDataAccessException(buildMessage(task, sql, ex), ex);
	}

	// Fallback to Spring's own SQL state translation...
	return null;
}
 
Example #10
Source File: ResultSetTest.java    From gemfirexd-oss with Apache License 2.0 5 votes vote down vote up
public void testGetNClobStringNotImplemented()
    throws SQLException {
    try {
        rs.getNClob("some-column-name");
        fail("ResultSet.getNClob(String) " +
             "should not be implemented");
    } catch (SQLFeatureNotSupportedException sfnse) {
        // We are fine, do nothing.
    }
}
 
Example #11
Source File: UpdateResultSetMethodsTest.java    From mariadb-connector-j with GNU Lesser General Public License v2.1 5 votes vote down vote up
@Test
public void testupdateAsciiStream33() {
  try {
    rs.updateAsciiStream("a", null);
  } catch (SQLFeatureNotSupportedException sqle) {
    Assert.fail();
  } catch (SQLException sqlee) {
    // eat
  }
}
 
Example #12
Source File: SnowflakePreparedStatementV1.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
@Override
@Deprecated
public void setUnicodeStream(int parameterIndex, InputStream x, int length)
throws SQLException
{
  throw new SQLFeatureNotSupportedException();
}
 
Example #13
Source File: SnowflakeBaseResultSet.java    From snowflake-jdbc with Apache License 2.0 5 votes vote down vote up
@Override
public void updateRowId(int columnIndex, RowId x) throws SQLException
{
  logger.debug(
      "public void updateRowId(int columnIndex, RowId x)");

  throw new SQLFeatureNotSupportedException();
}
 
Example #14
Source File: SQLFeatureNotSupportedExceptionTests.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create SQLFeatureNotSupportedException with message, SQLState, and Throwable
 */
@Test
public void test6() {
    SQLFeatureNotSupportedException ex =
            new SQLFeatureNotSupportedException(reason, state, t);
    assertTrue(ex.getMessage().equals(reason)
            && ex.getSQLState().equals(state)
            && cause.equals(ex.getCause().toString())
            && ex.getErrorCode() == 0);
}
 
Example #15
Source File: QueryTest.java    From elasticsearch-sql with Apache License 2.0 5 votes vote down vote up
@Test
public void idsQueryMultipleId() throws SqlParseException, SQLFeatureNotSupportedException {
    String query = String.format("select * from %s/dog where _id = IDS_QUERY(dog,1,2,3)",TEST_INDEX_DOG);
    SearchHit[] hits = query(query).getHits();
    Assert.assertEquals(1,hits.length);
    Map<String, Object> hitAsMap = hits[0].getSourceAsMap();
    Assert.assertEquals("rex",hitAsMap.get("dog_name"));
    Assert.assertEquals("Daenerys",hitAsMap.get("holdersName"));
    Assert.assertEquals(2, hitAsMap.get("age"));

}
 
Example #16
Source File: QueryTest.java    From elasticsearch-sql with Apache License 2.0 5 votes vote down vote up
@Test
public void twoSubQueriesTest() throws SqlParseException, SQLFeatureNotSupportedException {
    String query = String.format("select * from %s/dog where holdersName IN (select firstname from %s/account where firstname = 'Hattie') and age IN (select name.ofHisName from %s/gotCharacters where name.firstname <> 'Daenerys' and name.ofHisName IS NOT NULL) ",TEST_INDEX_DOG,TEST_INDEX_ACCOUNT,TEST_INDEX_GAME_OF_THRONES);
    SearchHit[] hits = query(query).getHits();
    Assert.assertEquals(1,hits.length);
    Map<String, Object> hitAsMap = hits[0].getSourceAsMap();
    Assert.assertEquals("snoopy",hitAsMap.get("dog_name"));
    Assert.assertEquals("Hattie",hitAsMap.get("holdersName"));
    Assert.assertEquals(4,hitAsMap.get("age"));

}
 
Example #17
Source File: DremioResultSetImpl.java    From dremio-oss with Apache License 2.0 5 votes vote down vote up
@Override
public void updateByte( int columnIndex, byte x ) throws SQLException {
  throwIfClosed();
  try {
    super.updateByte( columnIndex, x );
  }
  catch (UnsupportedOperationException e) {
    throw new SQLFeatureNotSupportedException(e.getMessage(), e);
  }
}
 
Example #18
Source File: AbstractUnsupportedOperationPreparedStatement.java    From shardingsphere with Apache License 2.0 4 votes vote down vote up
@Override
public final void setNClob(final int parameterIndex, final NClob x) throws SQLException {
    throw new SQLFeatureNotSupportedException("setNClob");
}
 
Example #19
Source File: TDatabaseMetaData.java    From micro-integrator with Apache License 2.0 4 votes vote down vote up
@Override
public <T> T unwrap(Class<T> tClass) throws SQLException {
    throw new SQLFeatureNotSupportedException("Functionality is not supported");  
}
 
Example #20
Source File: ConnectionPool.java    From document-management-software with GNU Lesser General Public License v3.0 4 votes vote down vote up
public java.util.logging.Logger getParentLogger() throws SQLFeatureNotSupportedException {
	return getWrappedDataSource().getParentLogger();
}
 
Example #21
Source File: UnsupportedOperationConnectionTest.java    From shardingsphere with Apache License 2.0 4 votes vote down vote up
@Test(expected = SQLFeatureNotSupportedException.class)
public void assertSetNetworkTimeout() throws SQLException {
    for (ShardingSphereConnection each : shardingSphereConnections) {
        each.setNetworkTimeout(null, 0);
    }
}
 
Example #22
Source File: CommonRowSetTests.java    From jdk8u-jdk with GNU General Public License v2.0 4 votes vote down vote up
@Test(dataProvider = "rowSetType",
        expectedExceptions = SQLFeatureNotSupportedException.class)
public void commonRowSetTest0119(RowSet rs) throws Exception {
    Reader rdr = null;
    rs.setClob("one", rdr, query.length());
}
 
Example #23
Source File: JoinTests.java    From elasticsearch-sql with Apache License 2.0 4 votes vote down vote up
@Test
public void joinWithAllAliasOnReturnNL() throws SQLFeatureNotSupportedException, IOException, SqlParseException {
    joinWithAllAliasOnReturn(true);
}
 
Example #24
Source File: TestJdbcPojoDataSource.java    From ignite with Apache License 2.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override public void setLogWriter(PrintWriter out) throws SQLException {
    throw new SQLFeatureNotSupportedException();
}
 
Example #25
Source File: ESResultSet.java    From sql4es with Apache License 2.0 4 votes vote down vote up
@Override
public void updateBinaryStream(String columnLabel, InputStream x, long length) throws SQLException {
	throw new SQLFeatureNotSupportedException();
}
 
Example #26
Source File: AbstractFeatureNotSupportedStatement.java    From elasticsearch-sql with MIT License 4 votes vote down vote up
@Override
public final void closeOnCompletion() throws SQLException {
    throw new SQLFeatureNotSupportedException("closeOnCompletion");
}
 
Example #27
Source File: PhoenixResultSet.java    From phoenix with Apache License 2.0 4 votes vote down vote up
@Override
public boolean absolute(int row) throws SQLException {
    throw new SQLFeatureNotSupportedException();
}
 
Example #28
Source File: IsDifferentXaDataSourceWrapper.java    From tomee with Apache License 2.0 4 votes vote down vote up
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
    return delegate.getParentLogger();
}
 
Example #29
Source File: ESResultSet.java    From sql4es with Apache License 2.0 4 votes vote down vote up
@Override
public void updateBoolean(int columnIndex, boolean x) throws SQLException {
	throw new SQLFeatureNotSupportedException();
}
 
Example #30
Source File: Driver.java    From quantumdb with Apache License 2.0 4 votes vote down vote up
@Override
public Logger getParentLogger() throws SQLFeatureNotSupportedException {
	return delegate.getParentLogger();
}