Hello !

I've installed tomcat4 and I'm using the MSSQL-JDBC-Driver with tomcats 
connectionpooling.

Now I have a question about timeouts.

In my JSP-site I get a connection from the pool, which works great.
But if the Database-Server is not reachable, the JSP does not give any 
feedback - it will wait for a connection for a very, very long time. After 
about 10-15 minutes, I get the following message:
[Microsoft][SQLServer 2000 Driver for JDBC]Error establishing socket.



Here's a test-jsp, which shows, where the script hangs:
----------------------------------------------------------------------------------
<%@ page language="java" 
import="java.util.*,java.sql.*,javax.sql.*,javax.naming.*" %>
<%
Connection db_con   = null;

Context initContext = new InitialContext();
Context envContext  = (Context)initContext.lookup("java:/comp/env");
DataSource ds       = (DataSource)envContext.lookup("jdbc/test_db");

if ( ds != null ) {
    try {
        // This is the place, where the script hangs, when the  
        // database-server is not avaible
        db_con = ds.getConnection();
    } catch ( SQLException se ) {
        System.out.println("Exception while connecting to db! (" +              
                                        se.getMessage() + ")");
    } finally {
        try { db_con.close(); } catch ( SQLException se ) {};
    }
}
%>
----------------------------------------------------------------------------------

Who can tell me, how to configure the timeout ?
I think, that 10-15 minutes is much to long :-(
(You will find the ressource-conf for my pool at the end of this mail)


Thank you very much for your help !


Greetings
Frank

----------------------------------------------------------------------------------
Ressource-Conf in my server.xml
----------------------------------------------------------------------------------


            <Resource name="jdbc/test_db" type="javax.sql.DataSource"/>
            <ResourceParams name="jdbc/test_db">
                <parameter>
                    <name>driverClassName</name>
                    
<value>com.microsoft.jdbc.sqlserver.SQLServerDriver</value>
                </parameter>
                <parameter>
                    <name>url</name>    
<value>jdbc:microsoft:sqlserver://192.168.0.199:1433;databasename=test_db</value>
                </parameter>
                <parameter>
                    <name>username</name>
                    <value>tester</value>
                </parameter>
                <parameter>
                    <name>password</name>
                    <value>test</value>
                </parameter>
                <parameter>
                    <name>validationQuery</name>
                    <value>select count(*) from users</value>
                </parameter>
                <parameter>
                    <name>maxWait</name>
                    <value>5000</value>
                </parameter>
                <parameter>
                    <name>maxActive</name>
                    <value>40</value>
                </parameter>
                <parameter>
                    <name>maxIdle</name>
                    <value>2</value>
                </parameter>
            </ResourceParams>

----------------------------------------------------------------------------------
web.xml
----------------------------------------------------------------------------------
<web-app>
  <description>Test-DB</description>
  <resource-ref>
      <description>DB Connection</description>
      <res-ref-name>jdbc/test_db</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
  </resource-ref>
</web-app>

----------------------------------------------------------------------------------

-- 
Name:   Frank von Daak
eMail:  [EMAIL PROTECTED]       Homepage: http://www.kpage.de
"If Bill Gates had a nickel for every time Windows crashed...
    - oh wait, he does."

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

Reply via email to