Uploaded image for project: 'OJB'
  1. OJB
  2. OJB-135

Can't get access to underlying DBCP connection for Oracle CLOBs greater than 4000 characters

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.0.4
    • None
    • None

    Description

      I might be missing something here but whenever PlatformOracle9iImpl is attempting to unwrap the underlying connection a DBCP pooled connection (pooled via Tomcat 5.5), it appears to be getting an IllegalAccessException since the class which is holding the wrapped connection is a private inner class (org.apache.commons.dbcp.dbcp.PoolingDriver.PoolGuardConnectionWrapper) so the genericUnwrap is returning null. This still occurs even if I set accessToUnderlyingConnectionAllowed to true on the DBCP data source factory.

      Spring has a class which implements this functionality called the CommonsDbcpNativeJdbcExtractor which deals with the successfully by falling back to retrieving the underlying connection from the Database metadata. If I patch PlatformOracle9iImpl accordingly, this works great. Here is the implementation of unwrapConnection which works successfully for me (note, code below is essentially copied from the aforementioned spring code):

      /**

      • Return an OracleConnection after trying to unwrap from known Connection wrappers.
      • @param conn the connection to unwrap (if needed)
      • @return OracleConnection or null if not able to unwrap
        */
        protected Connection unwrapConnection(Connection conn)
        {
        Object unwrapped = genericUnwrap(ORA_CONN_CLASS, conn, UNWRAP_CONN_METHOD_NAMES, UNWRAP_CONN_PARAM_TYPES);
        try {
        // We haven't received a different Connection, so we'll assume that there's
        // some additional proxying going on. Let's check whether we get something
        // different back from the DatabaseMetaData.getConnection() call.
        DatabaseMetaData metaData = conn.getMetaData();
        // The following check is only really there for mock Connections
        // which might not carry a DatabaseMetaData instance.
        if (metaData != null)
        Unknown macro: { Connection metaCon = metaData.getConnection(); if (metaCon != conn) { // We've received a different Connection there: // Let's retry the native extraction process with it. unwrapped = genericUnwrap(ORA_CONN_CLASS, metaCon, UNWRAP_CONN_METHOD_NAMES, UNWRAP_CONN_PARAM_TYPES); } }

        } catch (SQLException e)

        Unknown macro: { if (logger.isDebugEnabled()) { logger.debug("Failed attempting to unwrap connection via database metadata.", e); } }

        if (unwrapped == null)

        Unknown macro: { // mkalen}

        return (Connection) unwrapped;
        }

      Attachments

        Activity

          People

            arminw Armin Waibel
            ewestfal Eric Westfall
            Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: