tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Pringle <>
Subject Defect in parsing connectionProperties in a Resource declaration?
Date Thu, 04 Aug 2011 20:26:14 GMT
We're configuring a datasource like so in server.xml:

<Resource name="jdbc/UCPPool"
              description="UCP Pool in Tomcat"
              sqlForValidateConnection="select 1 from DUAL"
              connectionProperties=";;" />

Notice that the connectionProperties attribute has leading and trailing semicolons.  We've
noticed that if they are not present, then the leading/trailing characters are stripped out
of the value string.  Moreover, additional properties are just ignored.

Code we're using to see the behavior:

    DataSource ds = null;
    Connection conn = null;
    ResultSet result = null;
    Statement stmt = null;
    ResultSetMetaData rsmd = null;
      Context context = new InitialContext();
      Context envCtx = (Context) context.lookup("java:comp/env");
      ds =  (DataSource)envCtx.lookup("jdbc/UCPPool");
      if (ds != null) {
        PoolDataSourceImpl pds = (PoolDataSourceImpl)ds;
        System.out.println("Print all conn props:" + pds.getConnectionProperties().toString());
        System.out.println("Print value of just
" +pds.getConnectionProperty(""));
        conn = ds.getConnection();
        stmt = conn.createStatement();
        result = stmt.executeQuery("SELECT * FROM DEPT");

Print all conn props:{}
Print value of just 3000

This may be an error in the oracle factory (oracle.ucp.jdbc.PoolDataSourceImpl) or in the
parsing logic in Tomcat when reading the XML file.  I haven't been able to locate that code
for a quick review, nor have we had time to try passing that property to other drivers and
see if it works (thus narrowing suspicion on the oracle factory class).

Can someone point me to the area of code in tomcat that initially parses the resource (in
GlobalResources) and then instantiates the resources (I assume the actual instantiation is
via org.apache.naming.factory.ResourceFactory, but don't know the code path leading towards
that invocation).

We're seeing this on Tomcat 7.0.11 and (I think) on 7.0.14.

(Fedora 11, 64-bit, Sun JDK 64-bit).


Jason Pringle

This message and the information contained herein is proprietary and confidential and subject
to the Amdocs policy statement,
you may review at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message