You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Lev Assinovsky <le...@peterlink.ru> on 2002/03/14 14:23:08 UTC

[dbcp] Works with JNDI, but some remarks...

Hello all!
I got dbcp working through JNDI in Tomcat 4.0.4b1.
Thank you! (I got tired of Tyrex :-))

But I have several issues.

My configuration server.xml is:
         <Resource name="lev/DataSource" auth="Container"
                    type="javax.sql.DataSource"/>
          <ResourceParams name="lev/DataSource">
           <parameter><name>factory</name>
              
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
           </parameter>
 
            
<parameter><name>username</name><value>wv</value></parameter>
           
<parameter><name>password</name><value>wv</value></parameter>
            
<parameter><name>maxActive</name><value>100</value></parameter>
            
<parameter><name>maxIdle</name><value>30000</value></parameter>
            
<parameter><name>maxWait</name><value>100</value></parameter>
            <parameter><name>driverClassName</name>
              <value>org.gjt.mm.mysql.Driver</value></parameter> 
            <parameter><name>url</name>
             
<value>jdbc:mysql://localhost:3306/WV?user=wv&amp;password=wv</value></parameter> 
          </ResourceParams>

1. When I had 'user' instead of 'username' (Tyrex allows both) I got
NullPointer exception
in connectionProperties.put("user", username) in BasicDataSource.

2. When I didn't have maxActive I got infinite loop in  borrowObject()
in GenericObjectPool.

Actually I don't have clear understanding of the pool's parameters.
I'all really appreciate 
if somebody could make it clear for me.
 
Also with xml  parameters above I got very often:
 
java.sql.SQLException: Communication link failure: java.io.IOException
        at org.gjt.mm.mysql.MysqlIO.clearAllReceive(Unknown Source)
        at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source)
        at org.gjt.mm.mysql.MysqlIO.sqlQuery(Unknown Source)
        at org.gjt.mm.mysql.Connection.execSQL(Unknown Source)

or 
  NullPointerException.

However I created new connection pool (through JNDI lookup) on every
HTTP request since my bean where I did all above
had a scope="request" (just for testing).

And the last GLOBAL question. If I get datasource and connection in the
bean, then 
the only way to have one connection pool for all users who sends HTTP
request to my JSP (which using my bean)
is to have the scope "application" for the bean. Am I right?

Sincerely,
-- 
Lev Assinovsky                Peterlink Web
Programmer		      St. Petersburg, Russia
Tel/Fax: +7 812 3275343       197022 ul.Chapigina 7а
E-mail: lev@peterlink.ru

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