use of java.sql.SQLFeatureNotSupportedException in project ignite by apache.
the class JdbcConnection method createStatement.
/** {@inheritDoc} */
@Override
public Statement createStatement(int resSetType, int resSetConcurrency, int resSetHoldability) throws SQLException {
ensureNotClosed();
if (resSetType != TYPE_FORWARD_ONLY)
throw new SQLFeatureNotSupportedException("Invalid result set type (only forward is supported.)");
if (resSetConcurrency != CONCUR_READ_ONLY)
throw new SQLFeatureNotSupportedException("Invalid concurrency (updates are not supported).");
if (!txAllowed && resSetHoldability != HOLD_CURSORS_OVER_COMMIT)
throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
JdbcStatement stmt = new JdbcStatement(this);
statements.add(stmt);
return stmt;
}
use of java.sql.SQLFeatureNotSupportedException in project ignite by apache.
the class JdbcConnection method prepareStatement.
/** {@inheritDoc} */
@Override
public PreparedStatement prepareStatement(String sql, int resSetType, int resSetConcurrency, int resSetHoldability) throws SQLException {
ensureNotClosed();
if (resSetType != TYPE_FORWARD_ONLY)
throw new SQLFeatureNotSupportedException("Invalid result set type (only forward is supported.)");
if (resSetConcurrency != CONCUR_READ_ONLY)
throw new SQLFeatureNotSupportedException("Invalid concurrency (updates are not supported).");
if (!txAllowed && resSetHoldability != HOLD_CURSORS_OVER_COMMIT)
throw new SQLFeatureNotSupportedException("Invalid holdability (transactions are not supported).");
JdbcPreparedStatement stmt;
if (!stream)
stmt = new JdbcPreparedStatement(this, sql);
else {
GridQueryIndexing idx = ignite().context().query().getIndexing();
PreparedStatement nativeStmt = prepareNativeStatement(sql);
if (!idx.isInsertStatement(nativeStmt))
throw new IgniteSQLException("Only INSERT operations are supported in streaming mode", IgniteQueryErrorCode.UNSUPPORTED_OPERATION);
IgniteDataStreamer streamer = ignite().dataStreamer(cacheName);
streamer.autoFlushFrequency(streamFlushTimeout);
streamer.allowOverwrite(streamAllowOverwrite);
if (streamNodeBufSize > 0)
streamer.perNodeBufferSize(streamNodeBufSize);
if (streamNodeParOps > 0)
streamer.perNodeParallelOperations(streamNodeParOps);
stmt = new JdbcStreamedPreparedStatement(this, sql, streamer, nativeStmt);
}
statements.add(stmt);
return stmt;
}
use of java.sql.SQLFeatureNotSupportedException in project jena by apache.
the class JenaStatement method getMoreResults.
@Override
public boolean getMoreResults(int current) throws SQLException {
if (this.isClosed())
throw new SQLException("The Statement is closed");
switch(current) {
case Statement.CLOSE_CURRENT_RESULT:
return this.getMoreResults();
case Statement.CLOSE_ALL_RESULTS:
for (ResultSet rset : this.openResults) {
rset.close();
}
this.openResults.clear();
return this.getMoreResults();
case Statement.KEEP_CURRENT_RESULT:
if (this.currResults != null) {
this.openResults.add(this.currResults);
this.currResults = null;
}
return this.getMoreResults();
default:
throw new SQLFeatureNotSupportedException("Unsupported mode for dealing with current results, only Statement.CLOSE_CURRENT_RESULT, Statement.CLOSE_ALL_RESULTS and Statement.KEEP_CURRENT_RESULT are supported");
}
}
use of java.sql.SQLFeatureNotSupportedException in project phoenix by apache.
the class PhoenixRuntime method getFirstPKColumnExpression.
private static Expression getFirstPKColumnExpression(PTable table) throws SQLException {
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();
}
// skip salt and viewIndexId columns.
int pkPosition = (table.getBucketNum() == null ? 0 : 1) + (table.getViewIndexId() == null ? 0 : 1);
List<PColumn> pkColumns = table.getPKColumns();
return new RowKeyColumnExpression(pkColumns.get(pkPosition), new RowKeyValueAccessor(pkColumns, pkPosition));
}
use of java.sql.SQLFeatureNotSupportedException in project phoenix by apache.
the class PhoenixDriverTest method testDisallowIsolationLevel.
@Ignore
@Test
public void testDisallowIsolationLevel() throws SQLException {
Connection conn = DriverManager.getConnection(getUrl());
conn.setTransactionIsolation(Connection.TRANSACTION_NONE);
conn.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
try {
conn = DriverManager.getConnection(getUrl());
conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
fail();
} catch (SQLException e) {
assertEquals(SQLExceptionCode.TX_MUST_BE_ENABLED_TO_SET_ISOLATION_LEVEL.getErrorCode(), e.getErrorCode());
}
try {
conn = DriverManager.getConnection(getUrl());
conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
fail();
} catch (SQLFeatureNotSupportedException e) {
}
Properties props = PropertiesUtil.deepCopy(TestUtil.TEST_PROPERTIES);
props.setProperty(QueryServices.TRANSACTIONS_ENABLED, Boolean.toString(true));
conn = DriverManager.getConnection(getUrl(), props);
conn.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
try {
conn.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
fail();
} catch (SQLFeatureNotSupportedException e) {
}
}
Aggregations