tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Moore <johnmo...@pdsi-software.com>
Subject Resource References for DataSources
Date Thu, 03 Jan 2002 06:56:54 GMT

I have configured the sybase jdbc 2.0 driver to work with tomcat as a 
resource.  Unfortunately, there is no true pooling (min, max, timeout) 
feature and I need to wrap it with a real pooler.   The JBoss pooler 
works in other servlet containers but I can't figure out how to get it 
to work here.   I have tried various combinations of DataSources, 
parameter names and values to no avail.  I either get null or throw a 
tyrex exception (when type != javax.sql.DataSource).   The JBossPooler 
impelements DataSource, Referenceable and ObjectFactory so I though I 
would be able to just plug it in.


I saw one posting where a person loaded and registered the connections 
in their own servlet but that seems to defeat the purpose.  

server.xml

              <!-- works but doesn't support min/max -->
               <Resource name="jdbc/test" auth="Container" 
type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/test">
                  <parameter>
                    <name>driverClassName</name>
                    <value>com.sybase.jdbc2.jdbc.SybDataSource</value>
                </parameter>
                  <parameter>
                    <name>driverName</name>
                    
<value>jdbc:sybase:Tds:192.168.0.15:1498/telestaff</value>
                </parameter>
                   <parameter>
                    <name>user</name>
                    <value>dba</value>
                </parameter>
                <parameter>
                    <name>password</name>
                    <value>sql</value>
                </parameter>
              </ResourceParams>

             <!-- doesn't work (returns null on lookup) -->
              <Resource name="jdbc/webdemo" auth="Container" 
type="javax.sql.DataSource"/>
              <ResourceParams name="jdbc/webdemo">
                  <parameter>
                    <name>driverClassName</name>
                    <value>org.jboss.pool.jdbc.JDBCPoolDataSource</value>
                </parameter>
                <parameter>
                    <name>poolName</name>
                    <value>jdbc/webdemo</value>
                </parameter>

                  <parameter>
                    <name>JDBCURL</name>
                    
<value>jdbc:sybase:Tds:192.168.1.11:1498/telestaff</value>
                </parameter>
                   <parameter>
                    <name>JDBCUser</name>
                    <value>dba</value>
                </parameter>
                <parameter>
                    <name>JDBCPassword</name>
                    <value>sql</value>
                </parameter>
                <parameter>
                    <name>minSize</name>
                    <value>1</value>
                </parameter>
                <parameter>
                    <name>maxSize</name>
                    <value>2</value>
                </parameter>
              </ResourceParams>

web.xml

  <resource-ref>
      <res-ref-name>jdbc/test</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref> 

  <resource-ref>
      <res-ref-name>jdbc/webdemo</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
  </resource-ref> 


When I do a ctx.lookup I see a ResourceRef but when I to a ctx.lookup I 
get a null.  


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message