You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Gerlinde Fischer <ge...@wiai.uni-bamberg.de> on 2003/03/06 12:06:23 UTC

DBCP problems connection does not return

Hi,

I have the following problem:
The connection seems to be connected, but it does not return.
I want to use the naming datasource from tomcat.

Configuration: tomcat 4.1.18 standalone, database sapdb (I although tried
mysql, the same behaviour)
linux 8.0
commons-dbcp.jar, commons-pool.jar and sapdbc.jar in the common/lib
directory.

configuration in the server.xml file.

in my context whb I have made the following configuration:
------
          <Resource auth="Container" description="DB Connection"
name="jdbc/SapdbDS" scope="Shareable" type="javax.sql.DataSource"/>
          <ResourceParams name="jdbc/SapdbDS">
            <parameter>
              <name>url</name>
              <value>jdbc:sapdb://127.0.0.1/WHB?autocommit=off</value>
            </parameter>
            <parameter>
              <name>validationQuery</name>
              <value>select count(*) from katver</value>
            </parameter>
            <parameter>
              <name>maxIdle</name>
              <value>30</value>
            </parameter>
            <parameter>
              <name>maxActive</name>
              <value>100</value>
            </parameter>
            <parameter>
              <name>driverClassName</name>
              <value>com.sap.dbtech.jdbc.DriverSapDB</value>
            </parameter>
            <parameter>
              <name>maxWait</name>
              <value>5</value>
            </parameter>
            <parameter>
              <name>removeAbandoned</name>
              <value>true</value>
            </parameter>
            <parameter>
              <name>username</name>
              <value>user</value>
            </parameter>
            <parameter>
              <name>factory</name>
              <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
            </parameter>
             <parameter>
              <name>logAbandoned</name>
              <value>true</value>
            </parameter>
            <parameter>
              <name>removeAbandonedTimeout</name>
              <value>300</value>
            </parameter>
            <parameter>
              <name>password</name>
              <value>pw</value>
            </parameter>
          </ResourceParams>

----

It seems that I can connect to the database,
but the connection does not return.

Here the code with which I want to connect.
--------
  public Connection getConnection() throws SQLException {
  Connection con1=null;
    try
    {
    InitialContext initCtx = new InitialContext();
    Context envCtx = (Context) initCtx.lookup("java:comp/env");
    DataSource ds = (DataSource) envCtx.lookup("jdbc/SapdbDS");
    System.out.println("imTry  getconnecion nach datasource: ");
    con1 = ds.getConnection();
    System.out.println("imTry  nach getConntection: ");

    }
    catch (Exception e)
    {
      System.out.println("Fehler: getconnection " + e.getMessage());
      System.exit(1);
    }
  return con1;
  }
------

In the log-file catalina.out I found the following:
---

imTry  getconnecion nach datasource:
---

The output:  imTry  nach getConntection: does not appear.
After 2 hours on the web page I got. "page could not displaced".

Regrads Gerlinde


Universität Bamberg
Lehrstuhl für Wirtschaftsinformatik
Prof. Dr. Elmar J. Sinz
Projekt FlexNow!
Tel: ++49 951 863 2775
Fax: ++49 951 863 1195


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: DBCP problems connection does not return

Posted by Tomcat-RND <to...@hotmail.com>.
Hi,

DBCP will go to infinite if your validation query fails.
Please ensure that the table you are referring exists for extact name and
proper privileges exists to get the result, check the query with the SQL
prompt.
If your query results in no rows found, then also there is a possibility
that it will not give the connection.
But in your case as you are referring count(*) definetly you will get a
values either 0 or other number.
Please check the table once again exist in the database you are referring.

Regards,
Pratt.


----- Original Message -----
From: "Gerlinde Fischer" <ge...@wiai.uni-bamberg.de>
To: <to...@jakarta.apache.org>
Sent: Thursday, March 06, 2003 4:36 PM
Subject: DBCP problems connection does not return


> Hi,
>
> I have the following problem:
> The connection seems to be connected, but it does not return.
> I want to use the naming datasource from tomcat.
>
> Configuration: tomcat 4.1.18 standalone, database sapdb (I although tried
> mysql, the same behaviour)
> linux 8.0
> commons-dbcp.jar, commons-pool.jar and sapdbc.jar in the common/lib
> directory.
>
> configuration in the server.xml file.
>
> in my context whb I have made the following configuration:
> ------
>           <Resource auth="Container" description="DB Connection"
> name="jdbc/SapdbDS" scope="Shareable" type="javax.sql.DataSource"/>
>           <ResourceParams name="jdbc/SapdbDS">
>             <parameter>
>               <name>url</name>
>               <value>jdbc:sapdb://127.0.0.1/WHB?autocommit=off</value>
>             </parameter>
>             <parameter>
>               <name>validationQuery</name>
>               <value>select count(*) from katver</value>
>             </parameter>
>             <parameter>
>               <name>maxIdle</name>
>               <value>30</value>
>             </parameter>
>             <parameter>
>               <name>maxActive</name>
>               <value>100</value>
>             </parameter>
>             <parameter>
>               <name>driverClassName</name>
>               <value>com.sap.dbtech.jdbc.DriverSapDB</value>
>             </parameter>
>             <parameter>
>               <name>maxWait</name>
>               <value>5</value>
>             </parameter>
>             <parameter>
>               <name>removeAbandoned</name>
>               <value>true</value>
>             </parameter>
>             <parameter>
>               <name>username</name>
>               <value>user</value>
>             </parameter>
>             <parameter>
>               <name>factory</name>
>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
>             </parameter>
>              <parameter>
>               <name>logAbandoned</name>
>               <value>true</value>
>             </parameter>
>             <parameter>
>               <name>removeAbandonedTimeout</name>
>               <value>300</value>
>             </parameter>
>             <parameter>
>               <name>password</name>
>               <value>pw</value>
>             </parameter>
>           </ResourceParams>
>
> ----
>
> It seems that I can connect to the database,
> but the connection does not return.
>
> Here the code with which I want to connect.
> --------
>   public Connection getConnection() throws SQLException {
>   Connection con1=null;
>     try
>     {
>     InitialContext initCtx = new InitialContext();
>     Context envCtx = (Context) initCtx.lookup("java:comp/env");
>     DataSource ds = (DataSource) envCtx.lookup("jdbc/SapdbDS");
>     System.out.println("imTry  getconnecion nach datasource: ");
>     con1 = ds.getConnection();
>     System.out.println("imTry  nach getConntection: ");
>
>     }
>     catch (Exception e)
>     {
>       System.out.println("Fehler: getconnection " + e.getMessage());
>       System.exit(1);
>     }
>   return con1;
>   }
> ------
>
> In the log-file catalina.out I found the following:
> ---
>
> imTry  getconnecion nach datasource:
> ---
>
> The output:  imTry  nach getConntection: does not appear.
> After 2 hours on the web page I got. "page could not displaced".
>
> Regrads Gerlinde
>
>
> Universität Bamberg
> Lehrstuhl für Wirtschaftsinformatik
> Prof. Dr. Elmar J. Sinz
> Projekt FlexNow!
> Tel: ++49 951 863 2775
> Fax: ++49 951 863 1195
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org