Java Code Examples for org.apache.tomcat.jdbc.pool.DataSource#setDefaultAutoCommit()
The following examples show how to use
org.apache.tomcat.jdbc.pool.DataSource#setDefaultAutoCommit() .
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: PooledConnectionTomcat.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
private static void setupDataSource(Isolation isolation) { ds = new DataSource(); try { ds.setPoolProperties(getPoolProperties()); //set earlier to avoid overriding the isolation setting ds.setMaxActive(100); if (isolation == Isolation.NONE) { ds.setDefaultTransactionIsolation(Connection.TRANSACTION_NONE); } else if (isolation == Isolation.READ_COMMITTED) { ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); ds.setDefaultAutoCommit(false); } else { ds.setDefaultTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); ds.setDefaultAutoCommit(false); } dsSet = true; Log.getLogWriter().info("tomcat data source url is set as " + ds.getUrl()); Log.getLogWriter().info("tomcat data source DefaultTransactionIsolation is set to " + ds.getDefaultTransactionIsolation()); Log.getLogWriter().info("tomcat data source DefaultAutoCommit is set to " + ds.getDefaultAutoCommit()); } catch (Exception e) { throw new TestException("could not set data source" + TestHelper.getStackTrace(e)); } }
Example 2
Source File: PooledConnectionTomcat.java From gemfirexd-oss with Apache License 2.0 | 6 votes |
private static void setupDataSource(Isolation isolation) { ds = new DataSource(); try { ds.setPoolProperties(getPoolProperties()); //set earlier to avoid overriding the isolation setting ds.setMaxActive(100); if (isolation == Isolation.NONE) { ds.setDefaultTransactionIsolation(Connection.TRANSACTION_NONE); } else if (isolation == Isolation.READ_COMMITTED) { ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); ds.setDefaultAutoCommit(false); } else { ds.setDefaultTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ); ds.setDefaultAutoCommit(false); } dsSet = true; Log.getLogWriter().info("tomcat data source url is set as " + ds.getUrl()); Log.getLogWriter().info("tomcat data source DefaultTransactionIsolation is set to " + ds.getDefaultTransactionIsolation()); Log.getLogWriter().info("tomcat data source DefaultAutoCommit is set to " + ds.getDefaultAutoCommit()); } catch (Exception e) { throw new TestException("could not set data source" + TestHelper.getStackTrace(e)); } }