This page contains information specific to Oracles (generally broken) JDBC driver(s). This is information is a supplement to the general RDBMS data connector documentation. Start there before moving on to here. |
Application Managed data connectors which use Oracle JDBC Thin driver seem to be losing connections after an idle period. This results in an exception, reported in the idp-access.log, such as
11:59:29.339 - ERROR [edu.internet2.middleware.shibboleth.....RDBMSDataConnector:...] - RDBMS data connector [.., SELECT * FROM ...] - Unable to execute SQL query java.sql.SQLException: An SQLException was provoked by the following failure: com.mchange.v2.resourcepool.ResourcePoolException: Attempted to use a closed or broken resource pool |
Switching to a Container Managed connection seems to solve the problem.
To configure a Container Managed connection with Tomcat 6, operate as follow:
.jar
file into $TOMCAT_HOME/lib
$TOMCAT_HOME/conf/Catalina/localhost/idp.xml
, add a Resource section to it:
<Context docBase="/opt/shibboleth-idp/war/idp.war" privileged="true" antiResourceLocking="false" antiJARLocking="false" unpackWAR="false" swallowOutput="true" > <Resource name="jdbc/ORAIDP" type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver" url="jdbc:oracle:thin:@127.0.0.1:1521:mysid" validationQuery="SELECT 1 FROM dual" username="scott" password="tiger" maxActive="20" maxIdle="10" maxWait="-1" /> </Context> |
jdbc/ORAIDP
in the Deployment Fragment becomes java:comp/env/jdbc/ORAIDP
in the connector definition):
<resolver:DataConnector xsi:type="dc:RelationalDatabase" id="UNIQUE_ID"> <!-- Dependency and Failover information would go here --> <dc:ContainerManagedConnection resourceName="java:comp/env/jdbc/ORAIDP" /> ... |
Oracle converts all column names to uppercase names, independent of how the SQL statement looks like. Therefore, it is necessary to use column mappings in any case and even if you think the SQL looks ok. Also see ResolverRDBMSDataConnector |
More information on the Apache Commons DBCP wiki.