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=10591>.
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=10591

dataSource.getConnection never returns

           Summary: dataSource.getConnection never returns
           Product: Tomcat 4
           Version: 4.1.7
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Unknown
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


I'm using TC 4.1.7 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 servlet::init I do

            ctx = new javax.naming.InitialContext();
            ds = (javax.sql.DataSource)ctx.lookup
("java:comp/env/jdbc/WhitePages");
            System.err.println("init: have a datasource: " + ds);


and this prints

            ctx = new javax.naming.InitialContext();
            ds = (javax.sql.DataSource)ctx.lookup
("java:comp/env/jdbc/WhitePages");
            System.err.println("init: have a datasource: " + ds);


in my doGet I do

        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

I'm running the full 4.1.7 install on Windows XP Pro, JDK 1.4_01

In 4.0.4 the default behaviour (with Tyrex) works, however if I move to the 
Jakarta commons JNDI classes and specify the factory as 
org.apache.commons.dbcp.BasicDataSourceFactory
then this also hangs

To get this to work I also have to add

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

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

Surely this should work with the default?

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to