I had follow through the guideline from
http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html.
It is not working, it unable locate the <resource> in <context>. The
datasource.getConnection was return null. My appBase is mainhost and web
application is webapps directory.

This is my context in server.xml

        <Context path="/webapps" docBase="webapps" debug="5"
reloadable="true" crossContext="true">
            <Resource name="jdbc/myinformix" auth="Container"
                  type="javax.sql.DataSource"
driverClassName="com.informix.jdbc.IfxDriver"

url="jdbc:informix-sqli://hostname:port/dbname:INFORMIXSERVER=servernum;"
                  username="uid" password="password" maxActive="20"
maxIdle="10" maxWait="-1"/>

        </Context>

This is my web.xml

    <resource-ref>
        <description>DB Connection</description>
        <res-ref-name>jdbc/myinformix</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
        <res-auth>Container</res-auth>
    </resource-ref>

this is how system invoked

      Context initContext = new InitialContext();
      Context envContext = (Context) initContext.lookup("java:/comp/env");
      DataSource ds = (DataSource) envContext.lookup("jdbc/myinformix");
      Connection conn = ds.getConnection();

--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

On Tue, Jul 28, 2009 at 8:45 PM, Mark Shifman <[email protected]> wrote:

> You need to follow the tomcat documentation
> http://tomcat.apache.org/tomcat-5.5-doc/jndi-datasource-examples-howto.html
> and you don't need to download anything.
>
>>
>> DBCP uses the Jakarta-Commons Database Connection Pool. It relies on
>> number of Jakarta-Commons components:
>>
>>    * Jakarta-Commons DBCP
>>    * Jakarta-Commons Collections
>>    * Jakarta-Commons Pool
>>
>> These libraries are located in a single JAR at
>> |$CATALINA_HOME/common/lib/naming-factory-dbcp.jar|. However, only the
>> classes needed for connection pooling have been included, and the packages
>> have been renamed to avoid interfering with applications.
>>
>
>
> bye webster wrote:
>
>> Hello,
>>
>> I recently research on how to implement Database Connection Pooling into
>> Tomcat 5.5 server.
>> After downloaded dbcp.jar and pool.jar from Jakarta project and I follow
>> through the guideline provided.
>> Unfortunately, It is only working when i set jar file path in CLASSPATH
>> but
>> it unable load it when it is keep inside jre/lib/ext directory.
>> I thought all the jar will load in /lib/ext directory for all tomcat user.
>>
>> Who's know what's happening? i don't want messy my classpath setting so
>> who's know how to load it from lib/ext directory?
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>

Reply via email to