wood burning stoves 2.0*
The moose likes JDBC and the fly likes db connection pooling to mssql from Tomcat 4.0.6 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "db connection pooling to mssql from Tomcat 4.0.6" Watch "db connection pooling to mssql from Tomcat 4.0.6" New topic
Author

db connection pooling to mssql from Tomcat 4.0.6

Razvan Droscaru
Greenhorn

Joined: Jul 11, 2003
Posts: 3
Hello,

I know this was a very debated problem and often resolved. Db connection pooling to MSSQL Server from Tomcat 4.0.6. The error is:

org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver

I have put the commons-collections-3.0.jar, commons-dbcp-1.1.jar, commons-pool-1.1.jar, jtds-0.8-rc1.jar files in %TOMCAT_HOME%\common\lib\
My configuration files looks like:


1. %TOMCAT_HOME%\conf\server.xml

<context path="/testWEB" docBase="testWEB.war" debug="1" reloadable="true">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="testWEB_log."
suffix=".txt" timestamp="true"/>
<Resource name="jdbc/mspool" auth="Container" type="javax.sql.DataSource" />
<ResourceParams name="jdbc/mspool">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>user</name>
<value>razvan</value>
</parameter>
<parameter>
<name>password</name>
<value>razvan</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>net.sourceforge.jtds.jdbc.Driver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:jtds:sqlserver://localhost:1433/test;User=razvan;Password=razvan</value>
</parameter>
</ResourceParams>
</context>


2. %TOMCAT_HOME%\webapps\testWEB.war\WEB-INF\web.xml:

<web-app>
<display-name>testWEB</display-name>
<description>MSSQL Test App</description>
<resource-ref>
<res-ref-name>jdbc/mspool</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>

3. and Conn.java:

Context initCtx = new InitialContext();
DataSource ds = (DataSource)initCtx.lookup("java:comp/env/jdbc/mspool");
if (ds != null)
{
dbConnection = ds.getConnection();
}



If you have a solution, please give some feedback.


Thank you

Razvan Droscaru
 
jQuery in Action, 2nd edition
 
subject: db connection pooling to mssql from Tomcat 4.0.6
 
Similar Threads
JNDI Connection with Oracle (Problem with NullPointerException)
Connection Pool problem in tomcat 5
Cannot create JDBC driver
DBCP => Cannot create JDBC driver of class '' for connect URL 'null'
How Tomcat Works: connection pooling in tomcat