List of usage examples for org.apache.commons.dbcp2 Utils IS_SECURITY_ENABLED
boolean IS_SECURITY_ENABLED
To view the source code for org.apache.commons.dbcp2 Utils IS_SECURITY_ENABLED.
Click Source Link
From source file:JDBCPool.dbcp.demo.sourcecode.BasicDataSource.java
/** * Create (if necessary) and return a connection to the database. * * @throws SQLException if a database access error occurs * @return a database connection/*w ww. j a v a 2s .c o m*/ */ @Override public Connection getConnection() throws SQLException { if (Utils.IS_SECURITY_ENABLED) { PrivilegedExceptionAction<Connection> action = new PaGetConnection(); try { return AccessController.doPrivileged(action); } catch (PrivilegedActionException e) { Throwable cause = e.getCause(); if (cause instanceof SQLException) { throw (SQLException) cause; } throw new SQLException(e); } } return createDataSource().getConnection(); }