tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Konstantin Kolinko <knst.koli...@gmail.com>
Subject Re: tomcat 6 database pooling, DataSource returning NULL connection
Date Sun, 19 Jul 2009 00:41:02 GMT
See
http://tomcat.apache.org/tomcat-6.0-doc/deployer-howto.html#A%20word%20on%20Contexts

Tomcat makes a copy of your META-INF/context.xml when the application
is deployed, and will not see changes to that file unless you fully
undeploy and redeploy your application.


2009/7/19 Lucas Vickers <lucasvickers@gmail.com>:
> woops, email was sent prematurely
>
> anyway, the full email:
>
> META-INF/context.xml :
>
>  <Resource
>     name="jdbc/tabscorp_tabsdb"
>     auth="Container"
>     type="javax.sql.DataSource"
>         maxActive="100" maxIdle="30" maxWait="10000"
>         username="mylogin" password="mypass"
>     driverClassName="com.mysql.jdbc.Driver"
>     logAbandoned="true" removeAbandoned="true"
>     removeAbandonedTimeout="60"
>         url="jdbc:mysql://localhost:3306/mydb?autoReconnect=true"/>
>
> WEB-INF/web.xml :
>
>    <resource-ref>
>      <description>TABS DB Connection</description>
>      <res-ref-name>jdbc/tabscorp_tabsdb</res-ref-name>
>      <res-type>javax.sql.DataSource</res-type>
>      <res-auth>Container</res-auth>
>    </resource-ref>
>
>
> Java Code:
>
>                    InitialContext cxt = new InitialContext();
>                    if ( cxt == null ) {
>                        throw new Exception("InitialContext is NULL");
>                    }
>
>                    DataSource ds = (DataSource) cxt.lookup(
> "java:/comp/env/jdbc/tabscorp_tabsdb" );
>                    if ( ds == null ) {
>                        throw new Exception("Data source not found");
>                    }
>
>                    Connection conn = ds.getConnection();
>                    if ( conn == null) {
>                        throw new Exception("Connection is null");
>                    }
>
>                    stmt = connection.createStatement();
>
>
> I am getting a conn == null , but no other information, so I am having
> trouble debugging.
> suggestions?
>
> thanks
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message