tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Albert Farewege <>
Subject problem using connection pooling with Microsoft Sql Server as described in kB Article Q313173
Date Wed, 28 Dec 2005 17:16:13 GMT
I'm attempting to use the information provided in the Microsoft KB article
Q313173 { to set up connection
pooling using Tomcat 5.5. This is the most recent jdbc sql server article I
was able to locate (note reference to Tomcat 4.0 in the readme).

Q313173 article provides a zip file, which has a sample test page to confirm
the connection pool is working and a readme article with step by step
instructions. I've appended some of the readme's content below. I've also
appended the test page provided in the zip file.

I modified and confirmed (using osql) the database name, username, and
password in the resource parrameters definition for "jdbc/sql2000" would
access and select data. I placed the pool.jar in the Tomcat's common\lib

I am not able to get a connection using the sample test ("DataSource not

I am uncertain about the correctness of the readme file's instructions.
Permutations have not been successful, and there are a few of them. I'm
equally torn between the positions "the published example is always right"
and "the published example must be wrong." I've researched MARC, other
Microsoft kb articles.

My questions are:

In step 2 in the readme, the resource name & corresponding resource parms
name element values are different. Is this correct?

In step 2 in the readme, the references to the pool.jar file provided in the
zip file are to a package with ".mspool." rather than ".pool.". (Reason:
package explorer in eclipse expands them as pool). Is this correct?

In step 2 in the readme, the dsjndiname element points to another resource.
I think this is ok, but I would like confirmation.

Environment: xp home sp2, msde sql server 2000 Microsoft SQL Server  2000 -
8.00.2039 (Intel X86) May  3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft
Corporation Desktop Engine on Windows NT 5.1 (Build 2600: Service Pack 2),
Tomcat 5.5 (from select @@version query).

If everything is correct in Microsoft's zip and instructions, then I must
have missed an elementary step. I'm a novice.

Thank you for any suggestions.

=======================Extract Starts=========================
Configuratin Files:
2. pool.log
Setting up Sample connection Pool manager in Tomcat4.0:
1. Register DataSource. Specify the datasource class to be used and values
needed to
   initialize the DataSource class.
<Resource name="jdbc/sql2000" auth="Container" type=""/>
<ResourceParams name="jdbc/sql2000">
        <parameter><name>description</name><value>SQL Server
2. Register PoolDataSource. Here we specify the pool related properties and
a reference to the DataSource
   registered in step1.
<Resource name="jdbc/mspool" auth="Container" type=""/>
 <ResourceParams name="jdbc/mypool">
=======================Extract End=========================

Here is the test page provided by Microsoft in the zip file:

=======================Extract Starts=========================
Test Database Connection using Sample connectionpool manager with
Microsoft's Type 4 SQL Server 2000 JDBC Driver
<%@ page import="java.sql.*" %>
<%@ page import="javax.sql.*" %>
<%@ page import="javax.naming.*" %>

 String thisLine="";
 String query = "Select * from Jobs";
     Connection dbConnection = null;
     Statement dbStatement = null;
     ResultSet dbResultSet = null;
 PooledConnection pc =null;
 Context ctx = new InitialContext();
 Context envCtx=(Context)ctx.lookup("java:comp/env");
    <p><B>Got intital Context java:/comp/env/ .......<B></p>
        <b>Trying to lookup.................<B><br>
   DataSource ds = (DataSource)envCtx.lookup("jdbc/mspool");
        <b>Look up successs.........<B><br>
        <% if(ds!=null){
            dbConnection = ds.getConnection();
            dbStatement = dbConnection.createStatement();
            dbResultSet = dbStatement.executeQuery(query);
  ; %>
          <table width=80% border=2 cellspacing=2 cellpadding=3>
         <%  int i = 2;
           while( {
              thisLine = "";
               thisLine = "<td>";
               thisLine += dbResultSet.getString(i);
               thisLine += "</td>"; %>
               <TR bgcolor="white"><%= thisLine %></TR>
 <% }
 }else { %>
          <table width=80% border=2 cellspacing=2 cellpadding=3>
  thisLine = "DataSource not created";
     <TR bgcolor="white"><%= thisLine %></TR>
  <%   }

=======================Extract End=========================

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message