List of usage examples for java.sql ResultSet FETCH_REVERSE
int FETCH_REVERSE
To view the source code for java.sql ResultSet FETCH_REVERSE.
Click Source Link
From source file:com.alibaba.wasp.jdbc.TestJdbcStatement.java
@Test public void testStatement() throws SQLException, IOException, InterruptedException { Statement stat = conn.createStatement(); assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, conn.getHoldability()); conn.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT); assertEquals(ResultSet.CLOSE_CURSORS_AT_COMMIT, conn.getHoldability()); // ignored//ww w .j a va 2s . co m stat.setCursorName("x"); // fixed return value assertEquals(stat.getFetchDirection(), ResultSet.FETCH_FORWARD); // ignored stat.setFetchDirection(ResultSet.FETCH_REVERSE); // ignored stat.setMaxFieldSize(100); assertEquals(conf.getInt(FConstants.WASP_JDBC_FETCHSIZE, FConstants.DEFAULT_WASP_JDBC_FETCHSIZE), stat.getFetchSize()); stat.setFetchSize(10); assertEquals(10, stat.getFetchSize()); stat.setFetchSize(0); assertEquals(conf.getInt(FConstants.WASP_JDBC_FETCHSIZE, FConstants.DEFAULT_WASP_JDBC_FETCHSIZE), stat.getFetchSize()); assertEquals(ResultSet.TYPE_FORWARD_ONLY, stat.getResultSetType()); Statement stat2 = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_READ_ONLY, ResultSet.HOLD_CURSORS_OVER_COMMIT); assertEquals(ResultSet.TYPE_SCROLL_SENSITIVE, stat2.getResultSetType()); assertEquals(ResultSet.HOLD_CURSORS_OVER_COMMIT, stat2.getResultSetHoldability()); assertEquals(ResultSet.CONCUR_READ_ONLY, stat2.getResultSetConcurrency()); assertEquals(0, stat.getMaxFieldSize()); assertTrue(!((JdbcStatement) stat2).isClosed()); stat2.close(); assertTrue(((JdbcStatement) stat2).isClosed()); ResultSet rs; int count; boolean result; stat.execute("CREATE TABLE TEST {REQUIRED INT64 ID;" + "REQUIRED STRING VALUE; }PRIMARY KEY(ID), " + "ENTITY GROUP ROOT,ENTITY GROUP KEY(ID);"); TEST_UTIL.waitTableEnabled(Bytes.toBytes("TEST"), 5000); ResultInHBasePrinter.printMETA(conf, LOG); ResultInHBasePrinter.printFMETA(conf, LOG); ResultInHBasePrinter.printTable("test", "WASP_ENTITY_TEST", conf, LOG); conn.getTypeMap(); // this method should not throw an exception - if not supported, this // calls are ignored assertEquals(ResultSet.CONCUR_READ_ONLY, stat.getResultSetConcurrency()); // stat.cancel(); stat.setQueryTimeout(10); assertTrue(stat.getQueryTimeout() == 10); stat.setQueryTimeout(0); assertTrue(stat.getQueryTimeout() == 0); // assertThrows(SQLErrorCode.INVALID_VALUE_2, stat).setQueryTimeout(-1); assertTrue(stat.getQueryTimeout() == 0); trace("executeUpdate"); count = stat.executeUpdate("INSERT INTO TEST (ID,VALUE) VALUES (1,'Hello')"); assertEquals(1, count); count = stat.executeUpdate("INSERT INTO TEST (VALUE,ID) VALUES ('JDBC',2)"); assertEquals(1, count); count = stat.executeUpdate("UPDATE TEST SET VALUE='LDBC' WHERE ID=1"); assertEquals(1, count); count = stat.executeUpdate("DELETE FROM TEST WHERE ID=-1"); assertEquals(0, count); count = stat.executeUpdate("DELETE FROM TEST WHERE ID=1"); assertEquals(1, count); count = stat.executeUpdate("DELETE FROM TEST WHERE ID=2"); assertEquals(1, count); result = stat.execute("INSERT INTO TEST(ID,VALUE) VALUES(1,'Hello')"); assertTrue(!result); result = stat.execute("INSERT INTO TEST(VALUE,ID) VALUES('JDBC',2)"); assertTrue(!result); result = stat.execute("UPDATE TEST SET VALUE='LDBC' WHERE ID=2"); assertTrue(!result); result = stat.execute("DELETE FROM TEST WHERE ID=1"); assertTrue(!result); result = stat.execute("DELETE FROM TEST WHERE ID=2"); assertTrue(!result); result = stat.execute("DELETE FROM TEST WHERE ID=3"); assertTrue(!result); // getMoreResults rs = stat.executeQuery("SELECT ID,VALUE FROM TEST WHERE ID=1"); assertFalse(stat.getMoreResults()); assertThrows(SQLErrorCode.OBJECT_CLOSED, rs).next(); assertTrue(stat.getUpdateCount() == -1); count = stat.executeUpdate("DELETE FROM TEST WHERE ID=1"); assertFalse(stat.getMoreResults()); assertTrue(stat.getUpdateCount() == -1); WaspAdmin admin = new WaspAdmin(TEST_UTIL.getConfiguration()); admin.disableTable("TEST"); stat.execute("DROP TABLE TEST"); admin.waitTableNotLocked("TEST".getBytes()); stat.executeUpdate("DROP TABLE IF EXISTS TEST"); assertTrue(stat.getWarnings() == null); stat.clearWarnings(); assertTrue(stat.getWarnings() == null); assertTrue(conn == stat.getConnection()); admin.close(); stat.close(); }
From source file:com.github.woonsan.jdbc.jcr.impl.JcrJdbcResultSetTest.java
@Test public void testResultSetOptions() throws Exception { Statement statement = getConnection().createStatement(); ResultSet rs = statement.executeQuery(SQL_EMPS); assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); rs.setFetchDirection(ResultSet.FETCH_FORWARD); assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); try {//from ww w .j av a2 s . co m rs.setFetchDirection(ResultSet.FETCH_REVERSE); fail(); } catch (SQLException ignore) { } assertEquals(ResultSet.FETCH_FORWARD, rs.getFetchDirection()); rs.setFetchSize(100); assertEquals(100, rs.getFetchSize()); rs.close(); statement.close(); }
From source file:com.github.adejanovski.cassandra.jdbc.CassandraStatement.java
@SuppressWarnings("boxing") public void setFetchDirection(int direction) throws SQLException { checkNotClosed();//from w ww. j a va 2s .c om if (direction == ResultSet.FETCH_FORWARD || direction == ResultSet.FETCH_REVERSE || direction == ResultSet.FETCH_UNKNOWN) { if ((getResultSetType() == ResultSet.TYPE_FORWARD_ONLY) && (direction != ResultSet.FETCH_FORWARD)) throw new SQLSyntaxErrorException(String.format(BAD_FETCH_DIR, direction)); fetchDirection = direction; } else throw new SQLSyntaxErrorException(String.format(BAD_FETCH_DIR, direction)); }
From source file:org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl.java
/** * Constructor.//from ww w . j a v a 2 s . co m * * @param derivations whether to apply product derivations * @param loadGlobals whether to attempt to load the global properties */ public JDBCConfigurationImpl(boolean derivations, boolean loadGlobals) { super(false, false); String[] aliases; schema = addString("jdbc.Schema"); schemas = addStringList("jdbc.Schemas"); transactionIsolation = addInt("jdbc.TransactionIsolation"); aliases = new String[] { "default", String.valueOf(-1), "none", String.valueOf(Connection.TRANSACTION_NONE), "read-committed", String.valueOf(Connection.TRANSACTION_READ_COMMITTED), "read-uncommitted", String.valueOf(Connection.TRANSACTION_READ_UNCOMMITTED), "repeatable-read", String.valueOf(Connection.TRANSACTION_REPEATABLE_READ), "serializable", String.valueOf(Connection.TRANSACTION_SERIALIZABLE) }; transactionIsolation.setAliases(aliases); transactionIsolation.setDefault(aliases[0]); transactionIsolation.set(-1); transactionIsolation.setAliasListComprehensive(true); resultSetType = addInt("jdbc.ResultSetType"); aliases = new String[] { "forward-only", String.valueOf(ResultSet.TYPE_FORWARD_ONLY), "scroll-sensitive", String.valueOf(ResultSet.TYPE_SCROLL_SENSITIVE), "scroll-insensitive", String.valueOf(ResultSet.TYPE_SCROLL_INSENSITIVE), }; resultSetType.setAliases(aliases); resultSetType.setDefault(aliases[0]); resultSetType.set(ResultSet.TYPE_FORWARD_ONLY); resultSetType.setAliasListComprehensive(true); fetchDirection = addInt("jdbc.FetchDirection"); aliases = new String[] { "forward", String.valueOf(ResultSet.FETCH_FORWARD), "reverse", String.valueOf(ResultSet.FETCH_REVERSE), "unknown", String.valueOf(ResultSet.FETCH_UNKNOWN), }; fetchDirection.setAliases(aliases); fetchDirection.setDefault(aliases[0]); fetchDirection.set(ResultSet.FETCH_FORWARD); fetchDirection.setAliasListComprehensive(true); eagerFetchMode = new FetchModeValue("jdbc.EagerFetchMode"); eagerFetchMode.setDefault(FetchModeValue.EAGER_PARALLEL); eagerFetchMode.set(EagerFetchModes.EAGER_PARALLEL); addValue(eagerFetchMode); subclassFetchMode = new FetchModeValue("jdbc.SubclassFetchMode"); subclassFetchMode.setDefault(FetchModeValue.EAGER_JOIN); subclassFetchMode.set(EagerFetchModes.EAGER_JOIN); addValue(subclassFetchMode); lrsSize = addInt("jdbc.LRSSize"); aliases = new String[] { "query", String.valueOf(LRSSizes.SIZE_QUERY), "unknown", String.valueOf(LRSSizes.SIZE_UNKNOWN), "last", String.valueOf(LRSSizes.SIZE_LAST), }; lrsSize.setAliases(aliases); lrsSize.setDefault(aliases[0]); lrsSize.set(LRSSizes.SIZE_QUERY); lrsSize.setAliasListComprehensive(true); synchronizeMappings = addString("jdbc.SynchronizeMappings"); aliases = new String[] { "false", null }; synchronizeMappings.setAliases(aliases); synchronizeMappings.setDefault(aliases[0]); jdbcListenerPlugins = addPluginList("jdbc.JDBCListeners"); jdbcListenerPlugins.setInstantiatingGetter("getJDBCListenerInstances"); connectionDecoratorPlugins = addPluginList("jdbc.ConnectionDecorators"); connectionDecoratorPlugins.setInstantiatingGetter("getConnectionDecoratorInstances"); dbdictionaryPlugin = addPlugin("jdbc.DBDictionary", true); aliases = new String[] { "access", "org.apache.openjpa.jdbc.sql.AccessDictionary", "db2", "org.apache.openjpa.jdbc.sql.DB2Dictionary", "derby", "org.apache.openjpa.jdbc.sql.DerbyDictionary", "empress", "org.apache.openjpa.jdbc.sql.EmpressDictionary", "foxpro", "org.apache.openjpa.jdbc.sql.FoxProDictionary", "h2", "org.apache.openjpa.jdbc.sql.H2Dictionary", "hsql", "org.apache.openjpa.jdbc.sql.HSQLDictionary", "informix", "org.apache.openjpa.jdbc.sql.InformixDictionary", "ingres", "org.apache.openjpa.jdbc.sql.IngresDictionary", "jdatastore", "org.apache.openjpa.jdbc.sql.JDataStoreDictionary", "mysql", "org.apache.openjpa.jdbc.sql.MySQLDictionary", "oracle", "org.apache.openjpa.jdbc.sql.OracleDictionary", "pointbase", "org.apache.openjpa.jdbc.sql.PointbaseDictionary", "postgres", "org.apache.openjpa.jdbc.sql.PostgresDictionary", "soliddb", "org.apache.openjpa.jdbc.sql.SolidDBDictionary", "sqlserver", "org.apache.openjpa.jdbc.sql.SQLServerDictionary", "sybase", "org.apache.openjpa.jdbc.sql.SybaseDictionary", "maxdb", MaxDBDictionary.class.getCanonicalName(), }; dbdictionaryPlugin.setAliases(aliases); dbdictionaryPlugin.setInstantiatingGetter("getDBDictionaryInstance"); updateManagerPlugin = addPlugin("jdbc.UpdateManager", true); aliases = new String[] { "default", BatchingConstraintUpdateManager.class.getName(), "operation-order", "org.apache.openjpa.jdbc.kernel.OperationOrderUpdateManager", "constraint", "org.apache.openjpa.jdbc.kernel.ConstraintUpdateManager", "batching-constraint", BatchingConstraintUpdateManager.class.getName(), "batching-operation-order", BatchingOperationOrderUpdateManager.class.getName(), }; updateManagerPlugin.setAliases(aliases); updateManagerPlugin.setDefault(aliases[0]); updateManagerPlugin.setString(aliases[0]); updateManagerPlugin.setInstantiatingGetter("getUpdateManagerInstance"); driverDataSourcePlugin = addPlugin("jdbc.DriverDataSource", false); aliases = new String[] { "auto", "org.apache.openjpa.jdbc.schema.AutoDriverDataSource", "simple", "org.apache.openjpa.jdbc.schema.SimpleDriverDataSource", "dbcp", "org.apache.openjpa.jdbc.schema.DBCPDriverDataSource", }; driverDataSourcePlugin.setAliases(aliases); driverDataSourcePlugin.setDefault(aliases[0]); driverDataSourcePlugin.setString(aliases[0]); schemaFactoryPlugin = addPlugin("jdbc.SchemaFactory", true); aliases = new String[] { "dynamic", "org.apache.openjpa.jdbc.schema.DynamicSchemaFactory", "native", "org.apache.openjpa.jdbc.schema.LazySchemaFactory", "file", "org.apache.openjpa.jdbc.schema.FileSchemaFactory", "table", "org.apache.openjpa.jdbc.schema.TableSchemaFactory", // deprecated alias "db", "org.apache.openjpa.jdbc.schema.TableSchemaFactory", }; schemaFactoryPlugin.setAliases(aliases); schemaFactoryPlugin.setDefault(aliases[0]); schemaFactoryPlugin.setString(aliases[0]); schemaFactoryPlugin.setInstantiatingGetter("getSchemaFactoryInstance"); sqlFactoryPlugin = addPlugin("jdbc.SQLFactory", true); aliases = new String[] { "default", "org.apache.openjpa.jdbc.sql.SQLFactoryImpl", }; sqlFactoryPlugin.setAliases(aliases); sqlFactoryPlugin.setDefault(aliases[0]); sqlFactoryPlugin.setString(aliases[0]); sqlFactoryPlugin.setInstantiatingGetter("getSQLFactoryInstance"); mappingFactoryPlugin = new MappingFactoryValue("jdbc.MappingFactory"); addValue(mappingFactoryPlugin); mappingDefaultsPlugin = addPlugin("jdbc.MappingDefaults", true); aliases = new String[] { "default", "org.apache.openjpa.jdbc.meta.MappingDefaultsImpl", }; mappingDefaultsPlugin.setAliases(aliases); mappingDefaultsPlugin.setDefault(aliases[0]); mappingDefaultsPlugin.setString(aliases[0]); mappingDefaultsPlugin.setInstantiatingGetter("getMappingDefaultsInstance"); // set up broker factory defaults brokerFactoryPlugin.setAlias("jdbc", JDBCBrokerFactory.class.getName()); brokerFactoryPlugin.setDefault("jdbc"); brokerFactoryPlugin.setString("jdbc"); // set new default for mapping repos metaRepositoryPlugin.setAlias("default", "org.apache.openjpa.jdbc.meta.MappingRepository"); metaRepositoryPlugin.setDefault("default"); metaRepositoryPlugin.setString("default"); // set new default for lock manager lockManagerPlugin.setAlias("pessimistic", PessimisticLockManager.class.getName()); lockManagerPlugin.setDefault("pessimistic"); lockManagerPlugin.setString("pessimistic"); // native savepoint manager options savepointManagerPlugin.setAlias("jdbc", "org.apache.openjpa.jdbc.kernel.JDBC3SavepointManager"); // set new aliases and defaults for sequence seqPlugin.setAliases(JDBCSeqValue.ALIASES); seqPlugin.setDefault(JDBCSeqValue.ALIASES[0]); seqPlugin.setString(JDBCSeqValue.ALIASES[0]); // This plug-in is declared in superclass but defined here // because PreparedQueryCache is currently available for JDBC // backend only preparedQueryCachePlugin = addPlugin("jdbc.QuerySQLCache", true); aliases = new String[] { "true", "org.apache.openjpa.jdbc.kernel.PreparedQueryCacheImpl", "false", null }; preparedQueryCachePlugin.setAliases(aliases); preparedQueryCachePlugin.setAliasListComprehensive(true); preparedQueryCachePlugin.setDefault(aliases[0]); preparedQueryCachePlugin.setClassName(aliases[1]); preparedQueryCachePlugin.setDynamic(true); preparedQueryCachePlugin.setInstantiatingGetter("getQuerySQLCacheInstance"); finderCachePlugin = addPlugin("jdbc.FinderCache", true); aliases = new String[] { "true", "org.apache.openjpa.jdbc.kernel.FinderCacheImpl", "false", null }; finderCachePlugin.setAliases(aliases); finderCachePlugin.setAliasListComprehensive(true); finderCachePlugin.setDefault(aliases[0]); finderCachePlugin.setClassName(aliases[1]); finderCachePlugin.setDynamic(true); finderCachePlugin.setInstantiatingGetter("getFinderCacheInstance"); identifierUtilPlugin = addPlugin("jdbc.IdentifierUtil", true); aliases = new String[] { "default", "org.apache.openjpa.jdbc.identifier.DBIdentifierUtilImpl" }; identifierUtilPlugin.setAliases(aliases); identifierUtilPlugin.setDefault(aliases[0]); identifierUtilPlugin.setString(aliases[0]); identifierUtilPlugin.setInstantiatingGetter("getIdentifierUtilInstance"); // this static initializer is to get past a weird // ClassCircularityError that happens only under IBM's // JDK 1.3.1 on Linux from within the JRun ClassLoader; // while exact causes are unknown, it is almost certainly // a bug in JRun, and we can get around it by forcing // Instruction.class to be loaded and initialized // before TypedInstruction.class try { serp.bytecode.lowlevel.Entry.class.getName(); } catch (Throwable t) { } try { serp.bytecode.Instruction.class.getName(); } catch (Throwable t) { } supportedOptions().add(OPTION_QUERY_SQL); supportedOptions().add(OPTION_JDBC_CONNECTION); supportedOptions().remove(OPTION_VALUE_INCREMENT); supportedOptions().remove(OPTION_NULL_CONTAINER); if (derivations) ProductDerivations.beforeConfigurationLoad(this); if (loadGlobals) loadGlobals(); }
From source file:org.apache.openjpa.jdbc.kernel.JDBCFetchConfigurationImpl.java
public JDBCFetchConfiguration setFetchDirection(int direction) { if (direction != DEFAULT && direction != ResultSet.FETCH_FORWARD && direction != ResultSet.FETCH_REVERSE && direction != ResultSet.FETCH_UNKNOWN) throw new IllegalArgumentException( _loc.get("bad-fetch-direction", Integer.valueOf(direction)).getMessage()); if (direction == DEFAULT) { JDBCConfiguration conf = getJDBCConfiguration(); if (conf != null) _state.direction = conf.getFetchDirectionConstant(); } else/*from w w w . j a va 2s. c om*/ _state.direction = direction; return this; }
From source file:org.bidtime.dbutils.QueryRunnerEx.java
/** * Calls query after checking the parameters to ensure nothing is null. * @param conn The connection to use for the query call. * @param closeConn True if the connection should be closed, false otherwise. * @param sql The SQL statement to execute. * @param params An array of query replacement parameters. Each row in * this array is one set of batch replacement values. * @return The results of the query./*from w w w .j a va 2 s. com*/ * @throws SQLException If there are database or parameter errors. */ private <T> T query(Connection conn, boolean closeConn, String sql, ResultSetHandler<T> rsh, Object... params) throws SQLException { if (conn == null) { throw new SQLException("Null connection"); } if (sql == null) { if (closeConn) { close(conn); } throw new SQLException("Null SQL statement"); } if (rsh == null) { if (closeConn) { close(conn); } throw new SQLException("Null ResultSetHandler"); } PreparedStatement stmt = null; ResultSet rs = null; T result = null; long startTime = System.currentTimeMillis(); try { //stmt = this.prepareStatement(conn, sql); stmt = (PreparedStatement) conn.prepareStatement(sql, ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY); stmt.setFetchSize(StmtParams.getInstance().getFetchSize()); stmt.setFetchDirection(ResultSet.FETCH_REVERSE); stmt.setQueryTimeout(StmtParams.getInstance().getStmtQueryTimeOut()); this.fillStatement(stmt, params); rs = this.wrap(stmt.executeQuery()); result = rsh.handle(rs); } catch (SQLException e) { this.rethrow(e, sql, params); } finally { try { close(rs); } finally { close(stmt); if (closeConn) { close(conn); } } if (LogSelectSql.logInfoOrDebug()) { LogSelectSql.logFormatTimeNow(startTime, sql, params); } } return result; }
From source file:org.wso2.carbon.dataservices.core.description.query.SQLQuery.java
private void processAdvancedProps(Map<String, String> props) throws DataServiceFault { if (props == null) { return;/*from ww w. ja v a 2 s .c o m*/ } /* process fetch direction */ String fetchDirectionProp = props.get(RDBMS.FETCH_DIRECTION); if (!DBUtils.isEmptyString(fetchDirectionProp)) { fetchDirectionProp = fetchDirectionProp.trim(); if (AdvancedSQLProps.FETCH_DIRECTION_FORWARD.equals(fetchDirectionProp)) { this.fetchDirection = ResultSet.FETCH_FORWARD; } else if (AdvancedSQLProps.FETCH_DIRECTION_REVERSE.equals(fetchDirectionProp)) { this.fetchDirection = ResultSet.FETCH_REVERSE; } else { throw new DataServiceFault("Invalid fetch direction: " + fetchDirectionProp + ", valid values are {'" + AdvancedSQLProps.FETCH_DIRECTION_FORWARD + "', '" + AdvancedSQLProps.FETCH_DIRECTION_REVERSE + "'}"); } this.hasFetchDirection = true; } else { this.hasFetchDirection = false; } /* process fetch size */ String fetchSizeProp = props.get(RDBMS.FETCH_SIZE); if (!DBUtils.isEmptyString(fetchSizeProp)) { fetchSizeProp = fetchSizeProp.trim(); try { this.fetchSize = Integer.parseInt(fetchSizeProp); } catch (NumberFormatException e) { throw new DataServiceFault(e, "Invalid fetch size: " + fetchSizeProp + ", fetch size should be an integer"); } this.hasFetchSize = true; } else { this.hasFetchSize = false; } /* process max field size */ String maxFieldSizeProp = props.get(RDBMS.MAX_FIELD_SIZE); if (!DBUtils.isEmptyString(maxFieldSizeProp)) { maxFieldSizeProp = maxFieldSizeProp.trim(); try { this.maxFieldSize = Integer.parseInt(maxFieldSizeProp); if (this.maxFieldSize <= 0) { throw new DataServiceFault("Invalid maximum field size: " + maxFieldSizeProp + ", maximum field size should be a positive integer"); } } catch (NumberFormatException e) { throw new DataServiceFault(e, "Invalid maximum field size: " + maxFieldSizeProp + ", maximum field size should be a positive integer"); } this.hasMaxFieldSize = true; } else { this.hasMaxFieldSize = false; } /* process max rows */ String maxRowsProp = props.get(RDBMS.MAX_ROWS); if (!DBUtils.isEmptyString(maxRowsProp)) { maxRowsProp = maxRowsProp.trim(); try { this.maxRows = Integer.parseInt(maxRowsProp); if (this.maxRows <= 0) { throw new DataServiceFault( "Invalid maximum rows: " + maxRowsProp + ", maximum rows should be a positive integer"); } } catch (NumberFormatException e) { throw new DataServiceFault(e, "Invalid maximum rows: " + maxRowsProp + ", maximum rows should be a positive integer"); } this.hasMaxRows = true; } else { this.hasMaxRows = false; } /* process query timeout */ String queryTimeoutProp = props.get(RDBMS.QUERY_TIMEOUT); if (!DBUtils.isEmptyString(queryTimeoutProp)) { queryTimeoutProp = queryTimeoutProp.trim(); try { this.queryTimeout = Integer.parseInt(queryTimeoutProp); if (this.queryTimeout <= 0) { throw new DataServiceFault( "Invalid query timeout: " + queryTimeoutProp + ", query timeout be a positive integer"); } } catch (NumberFormatException e) { throw new DataServiceFault(e, "Invalid query timeout: " + queryTimeoutProp + ", query timeout be a positive integer"); } this.hasQueryTimeout = true; } else { this.hasQueryTimeout = false; } /* auto commit */ /* first check local auto commit setting */ String autoCommitProp = props.get(RDBMS.AUTO_COMMIT); if (!DBUtils.isEmptyString(autoCommitProp)) { autoCommitProp = autoCommitProp.trim(); try { boolean acBool = Boolean.parseBoolean(autoCommitProp); if (acBool) { this.autoCommit = AutoCommit.AUTO_COMMIT_ON; } else { this.autoCommit = AutoCommit.AUTO_COMMIT_OFF; } } catch (Exception e) { throw new DataServiceFault(e, "Invalid autocommit value: " + autoCommitProp + ", autocommit should be a boolean value"); } } else { /* global auto commit setting */ this.autoCommit = this.getConfig().getAutoCommit(); } /* force stored procedure */ String forceStoredProc = props.get(RDBMS.FORCE_STORED_PROC); if (!DBUtils.isEmptyString(forceStoredProc)) { this.forceStoredProc = Boolean.parseBoolean(forceStoredProc); } /* force JDBC batch requests */ String forceJDBCBatchRequests = props.get(RDBMS.FORCE_JDBC_BATCH_REQUESTS); if (!DBUtils.isEmptyString(forceJDBCBatchRequests)) { this.forceJDBCBatchReqs = Boolean.parseBoolean(forceJDBCBatchRequests); } }