This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes Connection pooling for Ms SQL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection pooling for Ms SQL" Watch "Connection pooling for Ms SQL" New topic
Author

Connection pooling for Ms SQL

dhana sugunan
Greenhorn

Joined: Dec 07, 2005
Posts: 1
Hi,

I am a newbie. After doing lot of digging work in the jakarta, java forum and google I am unable to fix the problem. Following is my problem. I am trying to establish connection pooling in the environment.

Tomcat 5.0.28
SQL server 2000

I have jar files in
tomcat home\common\lib ===>
commons-dbcp-1.2.1
commons-collection-3.1
commons-pool-1.2
mssqlserver.jar

also I have web-inf\lib ===>
jstl
standard

My server.xml is --->
<Context path="/DBTest" docBase="DBTest"
debug="5" reloadable="true" crossContext="true">

<Resource name="jdbc/TestDB"
auth="Container"
type="javax.sql.DataSource"/>

<ResourceParams name="jdbc/TestDB">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>

<parameter>
<name>maxActive</name>
<value>100</value>
</parameter>

<parameter>
<name>maxIdle</name>
<value>30</value>
</parameter>

<parameter>
<name>maxWait</name>
<value>10000</value>
</parameter>

<parameter>
<name>username</name>
<value>testuser</value>
</parameter>
<parameter>
<name>password</name>
<value>radha</value>
</parameter>

<parameter>
<name>driverClassName</name>
<value>com.microsoft.jdbcx.sqlserver.SQLServerDataSource</value>
</parameter>

<parameter>
<name>url</name>
<value>jdbc:microsoft:sqlserver://balaji:1433/pubs?autoReconnect=true</value>
</parameter>
</ResourceParams>
</Context>


My Web.xml ----->

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
version="2.4">
<description>Test App</description>
<resource-ref>
<description>DB Connection</description>
<res-ref-name>jdbc/TestDB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>


My testing jsp is --->

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<sql:query var="rs" dataSource="jdbc/TestDB">
select id, foo, bar from testdata
</sql:query>

<html>
<head>
<title>DB Test</title>
</head>
<body>

<h2>Results</h2>

<c:forEach var="row" items="${rs.rows}">
Foo ${row.foo}<br/>
Bar ${row.bar}<br/>
</c:forEach>

</body>
</html>

Following is the error I am getting while runnning the JSP

javax.servlet.ServletException: Unable to get connection, DataSource invalid: "org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null'"


Please suggest solutions to overcome this problem.
Dave Salter
Ranch Hand

Joined: Jul 20, 2005
Posts: 292

I think you need a few more SQL Server jar files. THere are 3 that are required IIRC.

You need msbase.jar, mssqlserver.jar and msutil.jar
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection pooling for Ms SQL
 
Similar Threads
DataSource Invalid
Configure tomcat resource factory
unable to implement connection pooling with sybase
MySQL Error - no driver
unable to implement connection pooling in sybase