Hi Peng,

Given below are server.xml and web.xml entries and code to access dbcp
resource from servlet.
When servlet is looking up for jndi name server hangs up with no response,
wiht 100% cpu busy signal.

With no exception message logged logs files.

Thanks in advance.
------------------
DBCP entry in server.xml :*******

<Resource name="jdbc/Resourcesdb" scope="Shareable"
type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/Resourcesdb">
            <parameter>
              <name>validationQuery</name>
              <value></value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>5000</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>4</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>resourcesdb</value>
            </parameter>
            <parameter>
              <name>url</name>
 
<value>jdbc:datadirect:sqlserver://serverName:1433;databaseName=name;User=na
me;Password=name</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>com.ddtek.jdbc.sqlserver.SQLServerDriver</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>2</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>resourcesdb</value>
            </parameter>
          </ResourceParams>

Entry for accessing DBCP resource in web.xml:**********

<resource-ref>
 <description>Datasource example</description>
 <res-ref-name>jdbc/Resourcesdb</res-ref-name>
 <res-type>javax.sql.DataSource</res-type>
 <res-auth>Container</res-auth>
</resource-ref>

Servlet code:***********

                        System.out.println("LoginServlet: Getting
InitialContext...");
                        InitialContext initCtx = new InitialContext();
                        System.out.println("LoginServlet: Got
InitialContext");

                        System.out.println("NameInNamespace ==> " +
                                            initCtx.getNameInNamespace());

                    DataSource ds =
(DataSource)initCtx.lookup("java:comp/env/jdbc/Resourcesdb");

                    if (ds != null)
                    {
                        conn = ds.getConnection();

                        if (conn != null)
                        {
                                System.out.println("Got Connection ==> \n" +
conn);

                            }
                            else
                            {
                                    System.out.println("Failed to get
connection.");
                                }
                    }
                    else
                    {
                            System.out.println("Failed to get datasource.");
                        }

---



-----Original Message-----
From: Peng Tuck Kwok [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 16, 2002 8:43 AM
To: Tomcat Users List
Subject: Re: Connection pooling with sql server


I've never managed to get tomcat to hang on a mis-configured db-pool, 
just got it to throw exceptions. Post your server.xml and web.xml and 
let the mailling list have a look. Your jsp or servlet if you are using 
any would be helpful.

Ashruf Hussain wrote:
> Hi all,
> 
> I am new user of tomcat 4.1, using jdbc driver from datadirect to connect
to
> sqlserver database. 
> I am able to get normal individual connections without pooling. 
> Now, I want to get connections from connection pool. 
> I tried with all my efforts (followed pooling documentation) to get
> connection pooling done with sql server, but tomcat hangs up at start up.
> 
> Anybody who has done it all, pls help.
> 
> Thanks in advance,
> 
> Ashruf
> 
> ---
> Regards, 
> Mohammed Ashruf Hussain
> Software Engineer.
> Virtusa, Corp. (formerly erunway)
> Work 040 23414200 ext(303)
> www.virtusa.com 
> 
> 
> 
> --
> To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
> 
> 



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

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

Reply via email to