You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by bu...@apache.org on 2002/07/09 16:42:11 UTC

DO NOT REPLY [Bug 10592] New: - dataSource.getConnection never returns in Tomcat using DBCP

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10592>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10592

dataSource.getConnection never returns in Tomcat using DBCP

           Summary: dataSource.getConnection never returns in Tomcat using
                    DBCP
           Product: Commons
           Version: unspecified
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Dbcp
        AssignedTo: commons-dev@jakarta.apache.org
        ReportedBy: kevinj@develop.com


I'm using Tomcat and I have a JNDI resource referencing an MSSQL database. 
The context looks like this

<Context path="/AddressBook" docBase="AddressBook" debug="0"  
reloadable="true">
  <Logger className="org.apache.catalina.logger.SystemOutLogger" 
timestamp="true"/>
  <Loader checkInterval="3"/>
  <Resource name="jdbc/WhitePages" auth="Container"  
type="javax.sql.DataSource"/>
  <ResourceParams name="jdbc/WhitePages">
    <parameter>
      <name>username</name>
      <value>sa</value>
    </parameter>
    <parameter>
      <name>password</name>
      <value></value>
    </parameter>
    <parameter>
      <name>driverClassName</name>
      <value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
    </parameter>
    <parameter>
      <name>url</name>
      
<value>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=WhitePages</value
>
    </parameter>
  </ResourceParams>
</Context>

In my I do

            ctx = new javax.naming.InitialContext();
            ds = (javax.sql.DataSource)ctx.lookup 
("java:comp/env/jdbc/WhitePages");

followed by

        java.sql.Connection conn = null;
        try
        {
            System.err.println("getConnection");
            synchronized(ds)
            {
                System.err.println("getConnection");
                conn = ds.getConnection();
            }

and the call to getConnection *never* returns

This happens in Tomcat 4.0.4 and later if their running DBCP

To get this to work I also have to add

    <parameter>
      <name>maxActive</name>
      <value>20</value>
    </parameter>

to my configuration

(I guess the value is irrelevant but I haven't tried that)

Surely this should work with the default maxActive value?

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>