String proxytype = properties.getProperty(OracleOCIConnectionPool.PROXYTYPE);
if(proxytype == null || proxytype.length() == 0) {
return super.connect(properties, session);
} else {
try {
OracleOCIConnectionPool oracleOCIConnectionPool = (OracleOCIConnectionPool)getDataSource();
if (oracleOCIConnectionPool == null) {
try {
oracleOCIConnectionPool = (OracleOCIConnectionPool)getContext().lookup(getName());
this.setDataSource(oracleOCIConnectionPool);
} catch (NamingException exception) {
throw ValidationException.cannotAcquireDataSource(getName(), exception);
}
}
return oracleOCIConnectionPool.getProxyConnection(proxytype, properties);
} catch (SQLException exception) {
throw DatabaseException.sqlException(exception, true);
} catch (ClassCastException classCastException) {
throw ValidationException.oracleOCIProxyConnectorRequiresOracleOCIConnectionPool();
}