Re: Connection pool

2005-07-21 Thread Christoph Kutzinski

Start a new discussion thread instead of hijacking this one.

And if you do that: give more information. What have you done so far? 
have you read the documentation? What are the error messages, if you 
already at that point? etc. etc.


Sridhar wrote:
Can anyone help how to create Connection Pool in Tomcat 5.0 with a 
Oracle9i database.


This is very urgnet...



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




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



Re: Connection pool exhausted

2005-07-20 Thread Peddireddy Srikanth
hi, 
u have to close the connection, sothat container puts it back in the pool .
as u set maxActive=100 at max only 100 connections will be
maintained in pool and as u r not closing the connection, u would have
ran out of all the connections available in pool (ie 100)
closing the connection should solve ur problem
check this link for more details 

http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html

regards
Srikanth Peddireddy

On 7/20/05, Tony Smith [EMAIL PROTECTED] wrote:
 I am runing tomcat 5.0 + postgresql. I set my
 connection pool in server.xml as:
 
Resource
  name=jdbc/mysource
  type=javax.sql.DataSource
  password=
  driverClassName=org.postgresql.Driver
  maxIdle=100
  maxWait=5000
  validationQuery=select * from test
  username=
  url=jdbc:postgresql://localhost:5432/mydb
  maxActive=100/
 
 I call it from my servlet as:
 
 public Connection getConnection(){
try{
Context initCtx = new InitialContext();
Context envCtx =
 (Context)initCtx.lookup(java:comp/env);
DataSource ds =
 (DataSource)envCtx.lookup(jdbc/mysource);
DatabaseManager.initDataSource(ds);
return ds.getConnection();
}catch(Exception e){
e.printStackTrace();
}
 
return null;
 }
 
 
 I use the connection as:
 
 Connection connection = getConnection();
 
 //jdbc
 
 //I did not call connection.close(). Should I?
 
 Then, I can run my web app. But not for long. I got
 the following exception after browse a few pages:
 
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
 get a connection, pool exhausted
 
 
 How can I fix it?
 
 Thanks,
 
 
 
 
 
 --- skausl [EMAIL PROTECTED] wrote:
 
 
  I have log4j-1.2.11.jar in Tomcat\common\lib and
  log4j.properties in
  Tomcat\common\classes\.
 
   -Original Message-
   Sorry if this is an oft-repeated question.
  Digging through
   old archives
   of this list and Google haven't turned up anything
  directly related.
  
   I'm trying to run Tomcat 5.5.9 as a windows
  service
   (installed it using
   service.bat), but for some unknown reason, it does
  not pick up the
   log4j.properties files located in my applications
  WEB-INF\classes
   directory.  As far as I can tell, the java
  options, classpath and
   startup class are identical for both.  Is this a
   limitation/weakness of
   the Windows Service or do I have something
  mis-configured?
  
   Thank You.
   Brian
 
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: Connection pool exhausted

2005-07-19 Thread Alon Belman
If you arent closing connections, then exhausting the connection pool
is the expected, eventual result.

Read the document at
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html,
paying special attention to the example of properly written code
[using] a db connection obtained from a connection pool near the
bottom of the page.




On 7/19/05, Tony Smith [EMAIL PROTECTED] wrote:
 I am runing tomcat 5.0 + postgresql. I set my
 connection pool in server.xml as:
 
 Resource
   name=jdbc/mysource
   type=javax.sql.DataSource
   password=
   driverClassName=org.postgresql.Driver
   maxIdle=100
   maxWait=5000
   validationQuery=select * from test
   username=
   url=jdbc:postgresql://localhost:5432/mydb
   maxActive=100/
 
 I call it from my servlet as:
 
 public Connection getConnection(){
 try{
 Context initCtx = new InitialContext();
 Context envCtx =
 (Context)initCtx.lookup(java:comp/env);
 DataSource ds =
 (DataSource)envCtx.lookup(jdbc/mysource);
 DatabaseManager.initDataSource(ds);
 return ds.getConnection();
 }catch(Exception e){
 e.printStackTrace();
 }
 
 return null;
 }
 
 
 I use the connection as:
 
 Connection connection = getConnection();
 
 //jdbc
 
 //I did not call connection.close(). Should I?
 
 Then, I can run my web app. But not for long. I got
 the following exception after browse a few pages:
 
 org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
 get a connection, pool exhausted
 
 
 How can I fix it?
 
 Thanks,
 
 
 
 
 
 --- skausl [EMAIL PROTECTED] wrote:
 
 
  I have log4j-1.2.11.jar in Tomcat\common\lib and
  log4j.properties in
  Tomcat\common\classes\.
 
   -Original Message-
   Sorry if this is an oft-repeated question.
  Digging through
   old archives
   of this list and Google haven't turned up anything
  directly related.
  
   I'm trying to run Tomcat 5.5.9 as a windows
  service
   (installed it using
   service.bat), but for some unknown reason, it does
  not pick up the
   log4j.properties files located in my applications
  WEB-INF\classes
   directory.  As far as I can tell, the java
  options, classpath and
   startup class are identical for both.  Is this a
   limitation/weakness of
   the Windows Service or do I have something
  mis-configured?
  
   Thank You.
   Brian
 
 
 
 -
  To unsubscribe, e-mail:
  [EMAIL PROTECTED]
  For additional commands, e-mail:
  [EMAIL PROTECTED]
 
 
 
 
 __
 Do You Yahoo!?
 Tired of spam?  Yahoo! Mail has the best spam protection around
 http://mail.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



Re: Connection pool exhausted

2005-07-19 Thread Nikola Milutinovic

Tony Smith wrote:


I am runing tomcat 5.0 + postgresql. I set my
connection pool in server.xml as:

   Resource
 name=jdbc/mysource
 type=javax.sql.DataSource
 password=
 driverClassName=org.postgresql.Driver
 maxIdle=100
 maxWait=5000
 validationQuery=select * from test
 



For PostgreSQL (and MySQL, too), this is better done via SELECT 
version(), just an observation.



 username=
 url=jdbc:postgresql://localhost:5432/mydb
 maxActive=100/
 



You can add parameters, like removeAbandoned to remove hanging 
connections.



I call it from my servlet as:

public Connection getConnection(){
   try{
   Context initCtx = new InitialContext();
   Context envCtx =
(Context)initCtx.lookup(java:comp/env);
DataSource ds =
(DataSource)envCtx.lookup(jdbc/mysource);
DatabaseManager.initDataSource(ds);
return ds.getConnection();
}catch(Exception e){
   e.printStackTrace();
   }

   return null;
}


I use the connection as:

Connection connection = getConnection();

//jdbc

//I did not call connection.close(). Should I?
 



YES! The Connection you get from this is a wrapper class, that will 
actually return the connection to the pool, when you call close() on it.



Then, I can run my web app. But not for long. I got
the following exception after browse a few pages:

org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot
get a connection, pool exhausted
 



Always close ResultSets, Statements and Connections - in that order.

This code will illustrate it for you:

PreparedStatement pstat = null;
ResultSet rs = null;
try {
   pstat = conn.prepareStatement( SELECT ... );
   pstat.setInt( 1, x );
   ...
   rs = pstat.execute();
   ...
} catch (SQLException ex) {
   ...
} finally {
   if (rs != null) {
  try {
 rs.close();
  } catch (SQLException ex1) {}
   }
   if (pstat != null) {
  try {
 pstat.close();
  } catch (SQLException ex1) {}
   }
   if (conn != null) {
  try {
 conn.close();
  catch (SQLException ex1) {}
   }
}

Nix.

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



Re: Connection Pool

2005-07-05 Thread Elaine

should this be: CONCUR_UPDATEABLE?

Sapales wrote:


Hi:

I´m working with Tomcat4 and a Connection Pool for accesing MySQL. But,
when I use the following code in a jsp:

%@ page import =java.sql.*, javax.sql.* %
%@ page import =javax.naming.InitialContext, javax.naming.Context %

htmlbody
%
Context mInitCtx = null;
DataSource mDs   = null;
Connection mConexion = null;
Statement mStmt  = null;
ResultSet mRs= null;

mInitCtx = new InitialContext();
mDs = (DataSource) mInitCtx.lookup(java:comp/env/jdbc/PoolConexiones);
mConexion = mDs.getConnection();
mStmt = mConexion.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE, 
ResultSet.CONCUR_UPDATABLE);

mRs = mStmt.executeQuery(SELECT * FROM PRECIOS);
   for(int i=1; i=10; i++)
{
mRs.moveToInsertRow();
mRs.updateInt(ORDEN,i);
mRs.insertRow();
mRs.moveToInsertRow();
}
%
OK
/body/html

I get the error: ResultSet not updatable

Why is it?

Thank you


¿Quieres conocer el futuro inmediato de la radio digital? Reportajes y
noticias del mundo de la Tecnología. ¡Ponte al día!

http://tecnologia.tiscali.es/




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




--
~
Where liberty dwells there is my country.

 Ancient Latin phrase 

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



RE: connection Pool leaking - how to detect it ?

2005-01-24 Thread Mike Curwen
I use the logAbandonded in our test server, and I find the log messages in
catalina.out.  The log message includes (as part of a stack trace, so you
will have to inspect the output a bit) the JSP page or class (and line!) in
which the connection was opened.

Here's an example:

DBCP object created 2005-01-24 09:09:33 by the following code was never
closed:
java.lang.Exception
at
org.apache.commons.dbcp.AbandonedTrace.init(AbandonedTrace.java:96)
at
org.apache.commons.dbcp.AbandonedTrace.init(AbandonedTrace.java:79)
at
org.apache.commons.dbcp.DelegatingResultSet.init(DelegatingResultSet.java:
71)
at
org.apache.commons.dbcp.DelegatingResultSet.wrapResultSet(DelegatingResultSe
t.java:80)
at
org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingP
reparedStatement.java:92)
at
com.acme.security.DataSourceAuthenticator.getAuthenticatedUser(DataSourceAut
henticator.java:40)
at
com.acme.security.SimpleLoginServlet.doPost(SimpleLoginServlet.java:76)



Mike Curwen


 -Original Message-
 From: Manisha Sathe [mailto:[EMAIL PROTECTED] 
 Sent: Monday, January 24, 2005 3:26 AM
 To: Tomcat Users List
 Subject: connection Pool leaking - how to detect it ?
 
 
 I just shifted to DataSource Connection pooling. I followed
  
 http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasourc
e-examples-howto.html
 
 
Here they have given 3 parameters to specify to control leaking  such as
removeAbandoned, removeAbandonedTimeout, logAbandoned
 
1) Is there any way to detect in which program / connection, resultsets etc
are not closed. I tried my best not to keep it open, but in case by mistake
it happend to be then how i can detect it ?
 
2) Also what is the meaning of logAbandoned - where i can see the log of
this ? 
 
 
regards
Manisha
 

__
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 


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



Re: RE: connection Pool leaking - how to detect it ?

2005-01-24 Thread bounce
Geachte relatie,

Het door u gebruikte e-mailadres is niet meer actief. U kunt uw e-mailbericht 
sturen naar [EMAIL PROTECTED] of dit bericht beantwoorden.

Bedankt voor uw medewerking,

Met vriendelijke groet,

ATP Hypotheken
Het Spoor 40
3994 AK Houten

Tel. 030 750 25 33
Fax. 030 750 25 88
[EMAIL PROTECTED]

 -- DIT IS EEN AUTOMATISCH GEGENEREERD E-MAILBERICHT --



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



Re: connection Pool and realms : how to avoid redundances

2004-08-25 Thread QM
On Wed, Aug 25, 2004 at 03:40:58PM +0200, Philippe Mathieu wrote:
: For me a correct war is a war where you don't have to touch to any pages to
: deploy the application. I think everybody is according to this.

So far, so good.


: - the database/user/password must be defined in the context definition for 
: the
: Pool and also for the Realm (thus 2 times !!).

Idea: DataSourceRealm
(Never used it, but I've seen it in the docs)


: - The pool name is defined in server.xml but also in web.xml and again in 
: my JSP
:  to obtain the connection (thus 3 times !!)

Idea: stop using Model1 architecture, so your JSPs don't have to know
about JDBC pools.


: I am however using the same method than described in the Tomcat doc in the 
: JDBC
: DataSources section :-(

Idea: context.xml

These, and most of your other questions could also be answered by a
closer reading of the Tomcat docs and/or changing your build process
such that Ant sets up variable params for you based on templates.

-QM

-- 

software  -- http://www.brandxdev.net
tech news -- http://www.RoarNetworX.com


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



RE: connection pool problems, etc.

2004-08-09 Thread Shapira, Yoav

Hi,
Note that Tomcat 5.0.27 already ships with DBCP 1.2.1.  As for database
drivers, your advice is good in general (and has nothing specifically to
do with Tomcat or DBCP) and people should follow it.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Steve Summit [mailto:[EMAIL PROTECTED]
Sent: Friday, August 06, 2004 8:20 PM
To: [EMAIL PROTECTED]
Subject: connection pool problems, etc.

It looks like lots of people are having various kinds of problems
involving pools, and threads, and connections (perhaps to databases),
and starvation, and hanging, and such.  (In fact, it was to ask
about just such a problem that I joined this list.)  I don't have
all the information yet, but I've discovered that my problems
were probably due to -- or at least seem to have been fixed by
updating -- a couple of .jar files:

  * The Jakarta common classes commons-dbcp.jar and commons-pool.jar

  * The Oracle JDBC driver classes12.jar or ojdbc14.jar

As I understand it, both Jakarta and Oracle have recently had
to fix bugs in these classes which involved pools, and threads,
and connections, and starvation, and hanging, and such.

The new versions of the Jakarta classes are
commons-dbcp-1.2.1.jar and commons-pool-1.2.jar, and I
downloaded them from http://jakarta.apache.org/commons/.

The new versions of the Oracle JDBC drivers come with newer
versions of Oracle, or can (so my dba tells me) be downloaded
from Oracle's site.

(Apologies if this is old news to everyone.)

   Steve Summit
   [EMAIL PROTECTED]

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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: connection pool docu

2004-07-30 Thread Betto McRose G,
try putting the jstl.jar and standard.jar into WEB-INF/lib

they're usually in jsp-examples/WEB-INF/lib


- Original Message - 
From: Lee Chin Khiong [EMAIL PROTECTED]
To: Tomcat Users List (E-mail) [EMAIL PROTECTED]
Sent: Friday, July 30, 2004 1:31 AM
Subject: connection pool docu



 Is the example in tomcat site document works ?

 I do what it say but not working, especially the taglib?

 Anybody knows what problem ?

 type Exception report

 message

 description The server encountered an internal error () that prevented it
 from fulfilling this request.

 exception

 org.apache.jasper.JasperException: The absolute uri:
 http://java.sun.com/jsp/jstl/core cannot be resolved in either web.xml or
 the jar files deployed with this application


org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.
 java:50)


org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409
 )


org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:118
 )


org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibrary
 InfoImpl.java:316)


org.apache.jasper.compiler.TagLibraryInfoImpl.init(TagLibraryInfoImpl.java
 :147)

 org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:418)
 org.apache.jasper.compiler.Parser.parseDirective(Parser.java:483)
 org.apache.jasper.compiler.Parser.parseElements(Parser.java:1539)
 org.apache.jasper.compiler.Parser.parse(Parser.java:126)


org.apache.jasper.compiler.ParserController.doParse(ParserController.java:22
 0)


org.apache.jasper.compiler.ParserController.parse(ParserController.java:101)
 org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:203)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:470)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
 org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)


org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:5
 11)


org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:2
 95)

 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:802)








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



RE: Connection pool detecting bad connection

2004-07-19 Thread Mike Curwen
for more than just Oracle, try SELECT 1


 -Original Message-
 From: V D [mailto:[EMAIL PROTECTED] 
 Sent: Saturday, July 17, 2004 7:33 AM
 To: Tomcat Users List
 Subject: Re: Connection pool detecting bad connection
 
 
 Thank you very much for the information.  I wonder what is the 
 implication of this in term of performance.  This effectively 
 double the 
 number of query if my query is small and one for each request 
 to have a 
 connection handle (but under very heavy load).  Also, what's 
 a generic 
 way for doing this across other database, for example, MySql, MS Sql, 
 etc.  Also, what if the table does not exist?
 


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



Re: Connection pool detecting bad connection

2004-07-17 Thread V D
Thank you very much for the information.  I wonder what is the 
implication of this in term of performance.  This effectively double the 
number of query if my query is small and one for each request to have a 
connection handle (but under very heavy load).  Also, what's a generic 
way for doing this across other database, for example, MySql, MS Sql, 
etc.  Also, what if the table does not exist?

I saw some other method, such as getMetaData, what is the implication of 
performance on this?

Thank you very much for your consideration,
Vy Ho
Holly, Michael wrote:
Configure your connection pool to use the 'Test On Borrow' feature.
This will send a small query out to make user the connection is
available before it uses the connection for the larger query.  Your
query could be like  SELECT 'test' from dual  if you are on Oracle.
Hope this helps
Michael 

-Original Message-
From: Vy Ho [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 16, 2004 2:15 PM
To: 'Tomcat Users List'
Subject: Connection pool detecting bad connection


I am sure people with DBCP background would know about this.  My 
question is what is the generic/common/standward JDBC way of check a 
connection to see if it's a good connection or not.  Check thing like:

con.isClosed() works in some case, and does not in another case.
Would retriveing the metadata do it?  What is the implication in term of
performance for this?
Thanks.
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 


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


RE: Connection pool detecting bad connection

2004-07-16 Thread Holly, Michael
Configure your connection pool to use the 'Test On Borrow' feature.
This will send a small query out to make user the connection is
available before it uses the connection for the larger query.  Your
query could be like  SELECT 'test' from dual  if you are on Oracle.


Hope this helps

Michael 

-Original Message-
From: Vy Ho [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 16, 2004 2:15 PM
To: 'Tomcat Users List'
Subject: Connection pool detecting bad connection



I am sure people with DBCP background would know about this.  My 
question is what is the generic/common/standward JDBC way of check a 
connection to see if it's a good connection or not.  Check thing like:

con.isClosed() works in some case, and does not in another case.

Would retriveing the metadata do it?  What is the implication in term of

performance for this?

Thanks.

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


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



RE: Connection pool exhausted

2004-06-02 Thread Nitschke Michael
It looks like you are not returning the connection in a propper way.
I mean just to close the resultset is not enough.
I use another connection pool, but I also get this kind of exception.
You have to obtain the statement form the resultset.
The connection from the statement.
Then close the resultset, then the statement.
And then give back the connection to the pool (overwritten version of
close, or a kind of freeConnection)
Never Close the connection. The pool could not reuse this instance
because its closed and so it could not be returned into the pool, and it
runs out of connections.

mfg
Michael Nitschke
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, June 02, 2004 10:01 AM
To: [EMAIL PROTECTED]
Subject: Connection pool exhausted

Hi all,
I am dveloping small application which uses JDBC connection pool.
This pool I configured according howto on Tomcat's pages.
Sometimes I get below mentioned exception: Connection pool
exhausted.  Could you give me any advice?
My configuration:
Tomcat 5.0/24
DB on localhost MySQL Distrib 4.0.17, for sun-solaris2.9 (sparc)
Thanks,
Petr

javax.servlet.ServletException:
org.apache.commons.dbcp.SQLNestedException: Cannot get a
connection, pool exhausted, cause: Timeout waiting for idle
object
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageCont
extImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContex
tImpl.java:758)
org.apache.jsp.jsp.Catalog_jsp._jspService(Catalog_jsp.java:202)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja
va:298)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
lter.java:322)
cz.shop.Controller.Dispatcher.goForward(Dispatcher.java:155)
cz.shop.Controller.Dispatcher.processRequest(Dispatcher.java:88)
cz.shop.Controller.Dispatcher.doGet(Dispatcher.java:166)
javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFi
lter.java:322)

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


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



Re: Connection Pool setup.

2004-04-02 Thread Kawthar Bt M Sulaiman

Hello, 

I'd like to know how to implement connection pooling in my
application.
This is what I had done so far.  Pls let me know what I need to change

to use the pooling mechanism.

1.  I created a singleton class: DatabaseOperations.
2.  It has an Connection instance: conn.
3.  During initialization, it gets connection as follows:
 DataSource ds  = (DataSource)
ctx.lookup(java:comp/env/jdbc/mySQLDatabase);
 conn = ds.getConnection();

4.  I have several public operations method (e.g selectOperations(...),
insertOperations(...)).
5.  Let's say I'd like to perform a select statement.  Inside my
selectOperations(...):
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery(...);
 process the result

 In my finally block, I have:
 rslt.close();
 stmt.close();

Questions:
1.  Do I need to code any different to enable the connection pooling?

2.  When I called ds.getConnection(), does it opens up several
connections for pooling
 or just one connection?

3.  Do I need to close conn every time as well?  Since conn is an
instance, 
 how does it gets connection everytime an operation method is
called? (insert, select, update).

That's all I have for now.  Thanks,
--Kawthar



Confidential information may be contained in this e-mail and any files transmitted 
with it ('Message'). If you are not the addressee indicated in this Message (or 
responsible for delivery of this Message to such person), you are hereby notified that 
any dissemination, distribution, printing or copying of this Message or any part 
thereof is strictly prohibited. In such a case, you should delete this Message 
immediately and advise the sender by return e-mail. Opinions, conclusions and other 
information in this Message that do not relate to the official business of Maxis shall 
be understood as neither given nor endorsed by Maxis.

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



RE: Connection Pool setup.

2004-04-02 Thread Kal Govindu
Hi,

Hello, 

I'd like to know how to implement connection pooling in my
application.
This is what I had done so far.  Pls let me know what I need to change

to use the pooling mechanism.

1.  I created a singleton class: DatabaseOperations.
2.  It has an Connection instance: conn.
3.  During initialization, it gets connection as follows:
 DataSource ds  = (DataSource)
ctx.lookup(java:comp/env/jdbc/mySQLDatabase);
 conn = ds.getConnection();

4.  I have several public operations method (e.g selectOperations(...),
insertOperations(...)).
5.  Let's say I'd like to perform a select statement.  Inside my
selectOperations(...):
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery(...);
 process the result

 In my finally block, I have:
 rslt.close();
 stmt.close();

Questions:
1.  Do I need to code any different to enable the connection pooling?
NO

2.  When I called ds.getConnection(), does it opens up several
connections for pooling
 or just one connection?
Depends on how you have it configured. maxActive and maxIdle settings for the 
resource.

3.  Do I need to close conn every time as well?  Since conn is an
instance, 
 how does it gets connection everytime an operation method is
called? (insert, select, update).

Yes, you have to close the connection each time, which returns the connection 
to the pool for
other processes to use. 

I have the following methods in my generic DataBase Operations class.
static public Connection getConnection() throws SQLException {
Connection conn = null;
try{
conn = ds.getConnection();
}
catch (Exception e) {
e.printStackTrace();
}
return conn;
}

static public void releaseConnection(Connection con){
try{
if (con != null)
con.close();
}
catch (Exception e) {
e.printStackTrace();
}
}

which get and close my connections for me. So, when I am in the selectOperations(..) I 
call the getConnetion()
to get a connection and in the finally block I call the releaseConnection() method.


Hope this helps.
Kal.


CONFIDENTIALITY NOTE:  All e-mail sent to or from this address will be received by the 
Waterfield Group corporate e-mail system and is subject to archival, monitoring, 
and/or review by someone other than the recipient or the sender.

This e-mail and any of its attachments may contain proprietary information, which is 
privileged and confidential.  This e-mail is intended solely for the use of the 
individual or entity to which it is addressed.  If you are not the intended recipient 
of this e-mail, you are hereby notified that any dissemination, distribution, copying, 
or action taken in relation to the contents of and attachments to this e-mail is 
strictly prohibited and may be unlawful.  If you have received this e-mail in error, 
please notify the sender immediately and permanently delete the original and any copy 
of this e-mail and any printout.  Thank you.


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



RE: Connection Pool setup.

2004-04-02 Thread Paul Mansfield
On Fri, 2004-04-02 at 13:47, Kal Govindu wrote:
 I'd like to know how to implement connection pooling in my
 application.
 This is what I had done so far.  Pls let me know what I need to change


you don't have to write any database pooling functions, it comes built
in!

http://jakarta.apache.org//tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html

basically, add some stuff to the server.xml file (and restart)

then in your app (note paranoid cleaning up of database handles!):
Connection con = null;
Statement stmt = null;
ResultSet rst = null;
try
{
Context ctx = new InitialContext();
if(ctx == null )
{
System.err.println(No Context\n);
}
else
{
DataSource ds =
(DataSource)ctx.lookup(java:comp/env/jdbc/MySQLDB);
if (ds != null)
{
con = ds.getConnection();
stmt = con.createStatement();
String sql = select ;
rst = stmt.executeQuery(sqlStmt.toString());
while rst.next()
{
blah blah
}
   rst.close(); rst = null;
   stmt.close(); stmt = null;
}
}
}
catch (java.sql.SQLException sqle)
{
if (rst != null)
try { rst.close(); rst = null; } catch (SQLException
sqle3) { }
if (stmt != null)
try { stmt.close(); stmt = null;} catch (SQLException
sqle2) { }
}


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



RE: Connection Pool setup.

2004-04-02 Thread Kawthar Bt M Sulaiman

Hi Kal,

Thank you... your getConnection() and releaseConnection() also very
helpful.
Will implement and test them... 

--Kawthar 

 [EMAIL PROTECTED] 02/04/2004 08:47:43 PM 
Hi,

Hello, 

I'd like to know how to implement connection pooling in my
application.
This is what I had done so far.  Pls let me know what I need to change

to use the pooling mechanism.

1.  I created a singleton class: DatabaseOperations.
2.  It has an Connection instance: conn.
3.  During initialization, it gets connection as follows:
 DataSource ds  = (DataSource)
ctx.lookup(java:comp/env/jdbc/mySQLDatabase);
 conn = ds.getConnection();

4.  I have several public operations method (e.g
selectOperations(...),
insertOperations(...)).
5.  Let's say I'd like to perform a select statement.  Inside my
selectOperations(...):
 Statement stmt = conn.createStatement();
 ResultSet rs = stmt.executeQuery(...);
 process the result

 In my finally block, I have:
 rslt.close();
 stmt.close();

Questions:
1.  Do I need to code any different to enable the connection pooling?
NO

2.  When I called ds.getConnection(), does it opens up several
connections for pooling
 or just one connection?
Depends on how you have it configured. maxActive and maxIdle
settings for the resource.

3.  Do I need to close conn every time as well?  Since conn is an
instance, 
 how does it gets connection everytime an operation method is
called? (insert, select, update).

Yes, you have to close the connection each time, which returns
the connection to the pool for
other processes to use. 

I have the following methods in my generic DataBase Operations class.
static public Connection getConnection() throws SQLException {
Connection conn = null;
try{
conn = ds.getConnection();
}
catch (Exception e) {
e.printStackTrace();
}
return conn;
}

static public void releaseConnection(Connection con){
try{
if (con != null)
con.close();
}
catch (Exception e) {
e.printStackTrace();
}
}

which get and close my connections for me. So, when I am in the
selectOperations(..) I call the getConnetion()
to get a connection and in the finally block I call the
releaseConnection() method.


Hope this helps.
Kal.


CONFIDENTIALITY NOTE:  All e-mail sent to or from this address will be
received by the Waterfield Group corporate e-mail system and is subject
to archival, monitoring, and/or review by someone other than the
recipient or the sender.

This e-mail and any of its attachments may contain proprietary
information, which is privileged and confidential.  This e-mail is
intended solely for the use of the individual or entity to which it is
addressed.  If you are not the intended recipient of this e-mail, you
are hereby notified that any dissemination, distribution, copying, or
action taken in relation to the contents of and attachments to this
e-mail is strictly prohibited and may be unlawful.  If you have received
this e-mail in error, please notify the sender immediately and
permanently delete the original and any copy of this e-mail and any
printout.  Thank you.


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


Confidential information may be contained in this e-mail and any files transmitted 
with it ('Message'). If you are not the addressee indicated in this Message (or 
responsible for delivery of this Message to such person), you are hereby notified that 
any dissemination, distribution, printing or copying of this Message or any part 
thereof is strictly prohibited. In such a case, you should delete this Message 
immediately and advise the sender by return e-mail. Opinions, conclusions and other 
information in this Message that do not relate to the official business of Maxis shall 
be understood as neither given nor endorsed by Maxis.

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



Re: Connection Pool setup.

2004-03-27 Thread Antonio Fiol Bonnín
Hi Gordon,

IMHO, all of them should be off for production. Your app is supposed to 
not leak any connections when it goes into production. And if you are 
not 100% sure of that, you'd better also have the log so that you can 
find and correct it.

So, again IMHO, these parameters mostly make sense when used together.

Antonio Fiol



Gordon Luk wrote:

Hi Antonio Fiol,

   Right, it should be helpful for development, we all want know what 
IT's doing? But for production, i think it should be off.

Gordon

Antonio Fiol Bonnín wrote:

Suggestion:

Also add the logAbandoned parameter and set it to true. I found 
it very useful at hard times.

Antonio Fiol

Gordon Luk wrote:

Hi Doug,

Thank for your advise, indeed my project state at begining. So every
thing is simple right now. BTW, i already experience on connection pool
on my previus ejb project. I will take care on it. As a simple mind,
take and go. :-)
Gordon

Parsons Technical Services wrote:

 

Gordon,

What about resultset and statement? Since this fixes it then you DO 
have a
leak. Break it down and check each step to make sure that they are 
returned,
even if an exception is thrown. I have it in finally clauses as a last
resort if it fails normally. There is something leaving the connection
hanging.

Doug
- Original Message - From: Gordon Luk 
[EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:31 AM
Subject: Re: Connection Pool setup.



 

Hi Doug,

  O, thanks, it's work... BTW, thanks for remind, and i am the good
citizen, allway return connection back to pool. ;-)
Gordon

Parsons Technical Services wrote:

 
   

Gordon,

Just for grins and giggles try adding this as a test:

  parameter
   nameremoveAbandoned/name
   valuetrue/value
   /parameter
   parameter
   nameremoveAbandonedTimeout/name
   value60/value
   /parameter
To reclaim abandoned connections.

If it drops you back to the min then you have a leak in you app.

Check that connections, resultsets and statements are all closed.

Doug

- Original Message - From: Gordon Luk 
[EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:18 PM
Subject: RE: Connection Pool setup.





Here my setting...

My problem is ... Connection pool look like don't open 10 
connection at
start-up, and when my servlet run for a while... Let it open up 
more
connections(over 30) and then wait... (after a night .. :-D)... 
When I
check database server, it still open more connections, I expect 
min. for
10 only.

My setup anything got wrong?  Thx.
---8
?xml version='1.0' encoding='utf-8'?
...
 ResourceParams name=jdbc/myjdniname
 parameter
 namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
 !-- Maximum number of dB connections in pool. Make sure you
  configure your mysqld max_connections large enough to handle
  all of your db connections. Set to 0 for no limit.
  --
 parameter
 namemaxActive/name
 value100/value
 /parameter
 !-- Maximum number of idle dB connections to retain in pool.
  Set to 0 for no limit.
  --
 parameter
 namemaxIdle/name
 value10/value
 /parameter
 parameter
 nameminIdle/name
 value10/value
 /parameter
 !-- Maximum time to wait for a dB connection to become
available
  in ms, in this example 10 seconds. An Exception is thrown if
  this timeout is exceeded.  Set to -1 to wait indefinitely.
  --
 parameter
 namemaxWait/name
 value1/value
 /parameter
 parameter
 nameusername/name
 valuemyuserid/value
 /parameter
 parameter
 namepassword/name
 valuemypassword/value
 /parameter
 !-- Class name for mm.mysql JDBC driver --
 parameter
 namedriverClassName/name
 valuenet.sourceforge.jtds.jdbc.Driver/value
 /parameter
 parameter
 nameurl/name
 value
jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value 

 /parameter
 parameter
 namevalidationQuery/name
 valueselect count(*) from tablename/value
 /parameter
 parameter
 nametestOnBorrow/name
 valuetrue/value
 /parameter
 parameter
 nametestWhileIdle/name
 valuetrue/value
 /parameter
 parameter
 nametimeBetweenEvictionRunsMillis/name
 value5000/value
 /parameter
 parameter
 nameminEvictableIdleTimeMillis/name
 value1/value
 /parameter
 /ResourceParams

/Context
---8
Regards,

Gordon Luk



-Original Message-
From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 7:03 PM
To: Tomcat Users List; Tomcat Users List
Subject: RE: Connection Pool setup.
May help if you post your resource snipplet (replacing any

Re: Connection Pool setup.

2004-03-26 Thread Gordon Luk
Hi Doug,

Thank for your advise, indeed my project state at begining. So every
thing is simple right now. BTW, i already experience on connection pool
on my previus ejb project. I will take care on it. As a simple mind,
take and go. :-)

Gordon

Parsons Technical Services wrote:

Gordon,

What about resultset and statement? Since this fixes it then you DO have a
leak. Break it down and check each step to make sure that they are returned,
even if an exception is thrown. I have it in finally clauses as a last
resort if it fails normally. There is something leaving the connection
hanging.

Doug
- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:31 AM
Subject: Re: Connection Pool setup.


  

Hi Doug,

O, thanks, it's work... BTW, thanks for remind, and i am the good
citizen, allway return connection back to pool. ;-)

Gordon

Parsons Technical Services wrote:



Gordon,

Just for grins and giggles try adding this as a test:

parameter
 nameremoveAbandoned/name
 valuetrue/value
 /parameter

 parameter
 nameremoveAbandonedTimeout/name
 value60/value
 /parameter

To reclaim abandoned connections.

If it drops you back to the min then you have a leak in you app.

Check that connections, resultsets and statements are all closed.

Doug

- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:18 PM
Subject: RE: Connection Pool setup.




  

Here my setting...

My problem is ... Connection pool look like don't open 10 connection at
start-up, and when my servlet run for a while... Let it open up more
connections(over 30) and then wait... (after a night .. :-D)... When I
check database server, it still open more connections, I expect min. for
10 only.

My setup anything got wrong?  Thx.
---8
?xml version='1.0' encoding='utf-8'?
...
   ResourceParams name=jdbc/myjdniname
   parameter
   namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   !-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
--
   parameter
   namemaxActive/name
   value100/value
   /parameter
   !-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
--
   parameter
   namemaxIdle/name
   value10/value
   /parameter
   parameter
   nameminIdle/name
   value10/value
   /parameter
   !-- Maximum time to wait for a dB connection to become
available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded.  Set to -1 to wait indefinitely.
--
   parameter
   namemaxWait/name
   value1/value
   /parameter
   parameter
   nameusername/name
   valuemyuserid/value
   /parameter
   parameter
   namepassword/name
   valuemypassword/value
   /parameter
   !-- Class name for mm.mysql JDBC driver --
   parameter
   namedriverClassName/name
   valuenet.sourceforge.jtds.jdbc.Driver/value
   /parameter
   parameter
   nameurl/name
   value

jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value
   /parameter
   parameter
   namevalidationQuery/name
   valueselect count(*) from tablename/value
   /parameter
   parameter
   nametestOnBorrow/name
   valuetrue/value
   /parameter
   parameter
   nametestWhileIdle/name
   valuetrue/value
   /parameter
   parameter
   nametimeBetweenEvictionRunsMillis/name
   value5000/value
   /parameter
   parameter
   nameminEvictableIdleTimeMillis/name
   value1/value
   /parameter
   /ResourceParams

/Context
---8

Regards,

Gordon Luk



-Original Message-
From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 7:03 PM
To: Tomcat Users List; Tomcat Users List
Subject: RE: Connection Pool setup.


May help if you post your resource snipplet (replacing any host
/user/passwd info)

-Original Message-
From: Gordon Luk [mailto:[EMAIL PROTECTED]
Sent: Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject: Connection Pool setup.

Hi All,

   May be I missing understand the DBCP configuration. Anyone could
help ? I want my connection pool are Max 100 connection, 10 conn. At
start-up, max idle 10, when idle for 10 min then kill it. Something like
that.

  Thanks.


Regards,

Gordon Luk



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http

RE: Connection pool in cayenne

2004-03-26 Thread Shapira, Yoav

Hi,
Yeah, call your DBA and ask him to allow more concurrent connections to
your DB.

Yoav Shapira
Millennium Research Informatics


-Original Message-
From: Salvatierra, Mauricio h (M.H.) [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 1:07 PM
To: 'Tomcat Users List'
Subject: Connection pool in cayenne

  Hi people. I using a connection pool in cayenne and have the next
error...

  ORA-00020: maximum number of processes...

  Any idea how resolve this problem. Thanks


   Saludos !!
   SALVATIERRA, Mauricio Hugo
   Information Technology
   Ford Argentina S.C.A.
   Phono/Fax: 54-11-4756-8750
   mailto: [EMAIL PROTECTED]
Visit our page: http//www.ford.com.ar/

***

*
STRICTLY CONFIDENTIAL. The contents of this e-mail and any attachments
are
strictly confidential and property of Ford Argentina S.C.A. They may
not be
used or disclosed by someone who is not a named recipient. If you have
received this e-mail in error please notify the sender by replying to
this
email inserting the word Misdirected as the message and delete the
present message.
***

*



-Original Message-
From: Tony Requist [mailto:[EMAIL PROTECTED]
Sent: Friday, March 26, 2004 14:44
To: Tomcat Users List
Subject: RE: Using PersistentValve for session replication



 I want to store session information in a database to be shared
 between a set
 of servers in a load balancing without session affinity
configuration.

Lacking input from others, I will answer part of my own question to
possibly
help somebody else.

The result is that with a day of work it is possible to use
PersistentValve
and PersistentManager to produce load balancing without session
affinity -- but you have to overcome some Tomcat issues in the code
along
the way.  My assumption is while the code is there, it has not been use
seriously and therefore is not shaken down.

I found and fixed (or worked around) a couple of Tomcat bugs along the
way.
If a Tomcat developer is interested in these, I would be glad to give
more
details:

* JDBCStore read and writes the database multiple times in load() and
save().  Adding break; in a couple strategic places fixes this

* As far as I can tell, the checkInterval attribute within
PersistentManager does not work at all

* PersistentValve loads the session for all requests, even static
content
(things like *.css, *.js, *.gif).  While this is not wrong, it does not
work
well.  I hacked around it, but there could be a clean solution

* Session data is always written out, even when it doesn't change.  I
added
a mechanism based on hashCode() to avoid this

* Deserialization errors are not handled correctly

* I could not get the logging to work so I added my own (this might
just be
my problem)

- tony



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

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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: Connection Pool setup.

2004-03-26 Thread Antonio Fiol Bonnín
Suggestion:

Also add the logAbandoned parameter and set it to true. I found it 
very useful at hard times.

Antonio Fiol

Gordon Luk wrote:

Hi Doug,

Thank for your advise, indeed my project state at begining. So every
thing is simple right now. BTW, i already experience on connection pool
on my previus ejb project. I will take care on it. As a simple mind,
take and go. :-)
Gordon

Parsons Technical Services wrote:

 

Gordon,

What about resultset and statement? Since this fixes it then you DO have a
leak. Break it down and check each step to make sure that they are returned,
even if an exception is thrown. I have it in finally clauses as a last
resort if it fails normally. There is something leaving the connection
hanging.
Doug
- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:31 AM
Subject: Re: Connection Pool setup.



   

Hi Doug,

  O, thanks, it's work... BTW, thanks for remind, and i am the good
citizen, allway return connection back to pool. ;-)
Gordon

Parsons Technical Services wrote:

  

 

Gordon,

Just for grins and giggles try adding this as a test:

  parameter
   nameremoveAbandoned/name
   valuetrue/value
   /parameter
   parameter
   nameremoveAbandonedTimeout/name
   value60/value
   /parameter
To reclaim abandoned connections.

If it drops you back to the min then you have a leak in you app.

Check that connections, resultsets and statements are all closed.

Doug

- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:18 PM
Subject: RE: Connection Pool setup.





   

Here my setting...

My problem is ... Connection pool look like don't open 10 connection at
start-up, and when my servlet run for a while... Let it open up more
connections(over 30) and then wait... (after a night .. :-D)... When I
check database server, it still open more connections, I expect min. for
10 only.
My setup anything got wrong?  Thx.
---8
?xml version='1.0' encoding='utf-8'?
...
 ResourceParams name=jdbc/myjdniname
 parameter
 namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
 !-- Maximum number of dB connections in pool. Make sure you
  configure your mysqld max_connections large enough to handle
  all of your db connections. Set to 0 for no limit.
  --
 parameter
 namemaxActive/name
 value100/value
 /parameter
 !-- Maximum number of idle dB connections to retain in pool.
  Set to 0 for no limit.
  --
 parameter
 namemaxIdle/name
 value10/value
 /parameter
 parameter
 nameminIdle/name
 value10/value
 /parameter
 !-- Maximum time to wait for a dB connection to become
available
  in ms, in this example 10 seconds. An Exception is thrown if
  this timeout is exceeded.  Set to -1 to wait indefinitely.
  --
 parameter
 namemaxWait/name
 value1/value
 /parameter
 parameter
 nameusername/name
 valuemyuserid/value
 /parameter
 parameter
 namepassword/name
 valuemypassword/value
 /parameter
 !-- Class name for mm.mysql JDBC driver --
 parameter
 namedriverClassName/name
 valuenet.sourceforge.jtds.jdbc.Driver/value
 /parameter
 parameter
 nameurl/name
 value
jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value
 /parameter
 parameter
 namevalidationQuery/name
 valueselect count(*) from tablename/value
 /parameter
 parameter
 nametestOnBorrow/name
 valuetrue/value
 /parameter
 parameter
 nametestWhileIdle/name
 valuetrue/value
 /parameter
 parameter
 nametimeBetweenEvictionRunsMillis/name
 value5000/value
 /parameter
 parameter
 nameminEvictableIdleTimeMillis/name
 value1/value
 /parameter
 /ResourceParams

/Context
---8
Regards,

Gordon Luk



-Original Message-
From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 7:03 PM
To: Tomcat Users List; Tomcat Users List
Subject: RE: Connection Pool setup.
May help if you post your resource snipplet (replacing any host
/user/passwd info)
-Original Message-
From: Gordon Luk [mailto:[EMAIL PROTECTED]
Sent: Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject: Connection Pool setup.
Hi All,

 May be I missing understand the DBCP configuration. Anyone could
help ? I want my connection pool are Max 100 connection, 10 conn. At
start-up, max idle 10, when idle for 10 min then kill it. Something like
that.
Thanks.

Regards,

Gordon Luk

 



-
To unsubscribe, e-mail

Re: Connection Pool setup.

2004-03-26 Thread Gordon Luk
Hi Antonio Fiol,

   Right, it should be helpful for development, we all want know what 
IT's doing? But for production, i think it should be off.

Gordon

Antonio Fiol Bonnín wrote:

Suggestion:

Also add the logAbandoned parameter and set it to true. I found it 
very useful at hard times.

Antonio Fiol

Gordon Luk wrote:

Hi Doug,

Thank for your advise, indeed my project state at begining. So every
thing is simple right now. BTW, i already experience on connection pool
on my previus ejb project. I will take care on it. As a simple mind,
take and go. :-)
Gordon

Parsons Technical Services wrote:

 

Gordon,

What about resultset and statement? Since this fixes it then you DO 
have a
leak. Break it down and check each step to make sure that they are 
returned,
even if an exception is thrown. I have it in finally clauses as a last
resort if it fails normally. There is something leaving the connection
hanging.

Doug
- Original Message - From: Gordon Luk [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:31 AM
Subject: Re: Connection Pool setup.


  

Hi Doug,

  O, thanks, it's work... BTW, thanks for remind, and i am the good
citizen, allway return connection back to pool. ;-)
Gordon

Parsons Technical Services wrote:

 


Gordon,

Just for grins and giggles try adding this as a test:

  parameter
   nameremoveAbandoned/name
   valuetrue/value
   /parameter
   parameter
   nameremoveAbandonedTimeout/name
   value60/value
   /parameter
To reclaim abandoned connections.

If it drops you back to the min then you have a leak in you app.

Check that connections, resultsets and statements are all closed.

Doug

- Original Message - From: Gordon Luk 
[EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:18 PM
Subject: RE: Connection Pool setup.



   
  

Here my setting...

My problem is ... Connection pool look like don't open 10 
connection at
start-up, and when my servlet run for a while... Let it open up more
connections(over 30) and then wait... (after a night .. :-D)... 
When I
check database server, it still open more connections, I expect 
min. for
10 only.

My setup anything got wrong?  Thx.
---8
?xml version='1.0' encoding='utf-8'?
...
 ResourceParams name=jdbc/myjdniname
 parameter
 namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
 !-- Maximum number of dB connections in pool. Make sure you
  configure your mysqld max_connections large enough to handle
  all of your db connections. Set to 0 for no limit.
  --
 parameter
 namemaxActive/name
 value100/value
 /parameter
 !-- Maximum number of idle dB connections to retain in pool.
  Set to 0 for no limit.
  --
 parameter
 namemaxIdle/name
 value10/value
 /parameter
 parameter
 nameminIdle/name
 value10/value
 /parameter
 !-- Maximum time to wait for a dB connection to become
available
  in ms, in this example 10 seconds. An Exception is thrown if
  this timeout is exceeded.  Set to -1 to wait indefinitely.
  --
 parameter
 namemaxWait/name
 value1/value
 /parameter
 parameter
 nameusername/name
 valuemyuserid/value
 /parameter
 parameter
 namepassword/name
 valuemypassword/value
 /parameter
 !-- Class name for mm.mysql JDBC driver --
 parameter
 namedriverClassName/name
 valuenet.sourceforge.jtds.jdbc.Driver/value
 /parameter
 parameter
 nameurl/name
 value
jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value 

 /parameter
 parameter
 namevalidationQuery/name
 valueselect count(*) from tablename/value
 /parameter
 parameter
 nametestOnBorrow/name
 valuetrue/value
 /parameter
 parameter
 nametestWhileIdle/name
 valuetrue/value
 /parameter
 parameter
 nametimeBetweenEvictionRunsMillis/name
 value5000/value
 /parameter
 parameter
 nameminEvictableIdleTimeMillis/name
 value1/value
 /parameter
 /ResourceParams

/Context
---8
Regards,

Gordon Luk



-Original Message-
From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 7:03 PM
To: Tomcat Users List; Tomcat Users List
Subject: RE: Connection Pool setup.
May help if you post your resource snipplet (replacing any host
/user/passwd info)
-Original Message-
From: Gordon Luk [mailto:[EMAIL PROTECTED]
Sent: Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject: Connection Pool setup.
Hi All,

 May be I missing understand the DBCP configuration. Anyone could
help ? I want my connection pool are Max 100 connection, 10 conn. At
start-up, max idle 10, when

RE: Connection Pool setup.

2004-03-25 Thread D'Alessandro, Arthur
May help if you post your resource snipplet (replacing any host /user/passwd info)

 -Original Message-
From:   Gordon Luk [mailto:[EMAIL PROTECTED]
Sent:   Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject:Connection Pool setup.

Hi All,

May be I missing understand the DBCP configuration. Anyone could
help ?
I want my connection pool are Max 100 connection, 10 conn. At start-up,
max idle 10, when idle for 10 min then kill it. Something like that.

   Thanks.


Regards,

Gordon Luk



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
 


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



Re: Connection Pool setup.

2004-03-25 Thread Peter Rossbach
That easy,

look at the DBCP Documentation  
http://jakarta.apache.org/commons/dbcp/configuration.html
and used the following

Resource name=jdbc/EmployeeDatabase auth=Container
   type=javax.sql.DataSource /
   ResourceParams name=jdbc/EmployeeDatabase
  parameter
nameusername/name
valueBlah/value
  /parameter
  parameter
namepassword/name
valueBlah or empty/value
  /parameter
  parameter
   namefactory/name
   
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
  parameter
namedriverClassName/name
valueorg.hsqldb.jdbcDriver/value
  /parameter
  parameter
nameurl/name
valuejdbc:hsqldb:hsql://localhost/value
  /parameter
  parameter
namemaxActive/name
value8/value
  /parameter
  parameter
namemaxIdle/name
value4/value
  /parameter
 parameter
namevalidationQuery/name
valueSELECT id FROM tomcat_validation WHERE id = 
1/value
   /parameter

   /ResourceParams

As your Database have timeouts or admin downtimes set up the 
tomcat_validation table with one dummy row
and use also Datasoucre at Realms :-)  DBCP has a lot of options to 
control the connections (s. detail configuration description)

Regards
Peter
http://tomcat.objektpark.org/

D'Alessandro, Arthur schrieb:

May help if you post your resource snipplet (replacing any host /user/passwd info)

-Original Message-
From:   Gordon Luk [mailto:[EMAIL PROTECTED]
Sent:   Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject:Connection Pool setup.
Hi All,

   May be I missing understand the DBCP configuration. Anyone could
help ?
I want my connection pool are Max 100 connection, 10 conn. At start-up,
max idle 10, when idle for 10 min then kill it. Something like that.
  Thanks.

Regards,

Gordon Luk



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004


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


 





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


Re: Connection Pool

2004-03-25 Thread Parsons Technical Services
Sounds like a leak in you program. Check to make sure the connection,
resultset and statement are being closed.

A work around is to add:

  parameter
  nameremoveAbandoned/name
  valuetrue/value
  /parameter

  parameter
  nameremoveAbandonedTimeout/name
  value60/value
  /parameter

To reclaim abandoned connections.

Doug

www.parsonstechnical.com


- Original Message - 
From: armalai [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 8:52 AM
Subject: Connection Pool


Environement: Tomcat4.x ,Windows 2000 , Oracle9i

I'm using 75 concurrent users to hit my application using Jmeter.
After 5 hours i'm getting this below error.

ERROR: Cannot get a connection, pool exhausted

1.Can you please give me an idea to tune up my settings?
2.This is something sue to server's unavailable state?



this is my data base connection setting.

  Resource name=jdbc/CONTROLLER scope=Shareable
type=javax.sql.DataSource/
  ResourceParams name=jdbc/CONTROLLER
parameter
  namedriverClassName/name
  valueoracle.jdbc.OracleDriver/value
/parameter
parameter
  nameurl/name
  valuejdbc:oracle:oci:@CURACC_DEV/value
/parameter
parameter
  nameusername/name
  valuesysadm/value
/parameter
parameter
  namepassword/name
  valuesysadmawbs/value
/parameter
parameter
  namemaxActive/name
  value20/value
/parameter
parameter
  namemaxWait/name
  value1/value
/parameter
parameter
  namemaxIdle/name
  value10/value
/parameter
  /ResourceParams


Thanks.,
MALAI



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



RE: Connection Pool

2004-03-25 Thread Tom K
Armalai,

This is some of the parameters I noted you didn't have, BUT,
they are from the Tomcat 5, so check the docs. Just by looking at the
verbiage of the tags, they look like they might be helpful.

Tom Kochanowicz



!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit.
--
parameter
namemaxIdle/name
value30/value
/parameter

!-- Maximum time to wait for a dB
connection to become available
 in ms, in this example 10 seconds. An
Exception is thrown if
 this timeout is exceeded.  Set to -1 to
wait indefinitely.
--
parameter
namemaxWait/name
value1/value
/parameter

!-- To configure a DBCP DataSource so
that abandoned dB connections
 are removed and recycled 
--
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter




-Original Message-
From: armalai [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 7:53 AM
To: Tomcat Users List
Subject: Connection Pool

Environement: Tomcat4.x ,Windows 2000 , Oracle9i

I'm using 75 concurrent users to hit my application using Jmeter.
After 5 hours i'm getting this below error. 

ERROR: Cannot get a connection, pool exhausted

1.Can you please give me an idea to tune up my settings?
2.This is something sue to server's unavailable state?



this is my data base connection setting.

  Resource name=jdbc/CONTROLLER scope=Shareable
type=javax.sql.DataSource/
  ResourceParams name=jdbc/CONTROLLER
parameter
  namedriverClassName/name
  valueoracle.jdbc.OracleDriver/value
/parameter
parameter
  nameurl/name
  valuejdbc:oracle:oci:@CURACC_DEV/value
/parameter
parameter
  nameusername/name
  valuesysadm/value
/parameter
parameter
  namepassword/name
  valuesysadmawbs/value
/parameter
parameter
  namemaxActive/name
  value20/value
/parameter
parameter
  namemaxWait/name
  value1/value
/parameter
parameter
  namemaxIdle/name
  value10/value
/parameter
  /ResourceParams


Thanks.,
MALAI

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.557 / Virus Database: 349 - Release Date: 12/30/2003
 


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



RE: Connection Pool setup.

2004-03-25 Thread Gordon Luk
Here my setting...

My problem is ... Connection pool look like don't open 10 connection at
start-up, and when my servlet run for a while... Let it open up more
connections(over 30) and then wait... (after a night .. :-D)... When I
check database server, it still open more connections, I expect min. for
10 only.

My setup anything got wrong?  Thx.
---8
?xml version='1.0' encoding='utf-8'?
...
ResourceParams name=jdbc/myjdniname
parameter
namefactory/name
 
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
!-- Maximum number of dB connections in pool. Make sure you
 configure your mysqld max_connections large enough to handle
 all of your db connections. Set to 0 for no limit.
 --
parameter
namemaxActive/name
value100/value
/parameter
!-- Maximum number of idle dB connections to retain in pool.
 Set to 0 for no limit.
 --
parameter
namemaxIdle/name
value10/value
/parameter
parameter
nameminIdle/name
value10/value
/parameter
!-- Maximum time to wait for a dB connection to become
available
 in ms, in this example 10 seconds. An Exception is thrown if
 this timeout is exceeded.  Set to -1 to wait indefinitely.
 --
parameter
namemaxWait/name
value1/value
/parameter
parameter
nameusername/name
valuemyuserid/value
/parameter
parameter
namepassword/name
valuemypassword/value
/parameter
!-- Class name for mm.mysql JDBC driver --
parameter
namedriverClassName/name
valuenet.sourceforge.jtds.jdbc.Driver/value
/parameter
parameter
nameurl/name
value 
 
jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value
/parameter
parameter
namevalidationQuery/name
valueselect count(*) from tablename/value
/parameter
parameter
nametestOnBorrow/name
valuetrue/value
/parameter
parameter
nametestWhileIdle/name
valuetrue/value
/parameter
parameter
nametimeBetweenEvictionRunsMillis/name
value5000/value
/parameter
parameter
nameminEvictableIdleTimeMillis/name
value1/value
/parameter
/ResourceParams

/Context
---8

Regards,

Gordon Luk



-Original Message-
From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 7:03 PM
To: Tomcat Users List; Tomcat Users List
Subject: RE: Connection Pool setup.


May help if you post your resource snipplet (replacing any host
/user/passwd info)

 -Original Message-
From:   Gordon Luk [mailto:[EMAIL PROTECTED]
Sent:   Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject:Connection Pool setup.

Hi All,

May be I missing understand the DBCP configuration. Anyone could
help ? I want my connection pool are Max 100 connection, 10 conn. At
start-up, max idle 10, when idle for 10 min then kill it. Something like
that.

   Thanks.


Regards,

Gordon Luk



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
 


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


---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
 

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
 


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



Re: Connection Pool setup.

2004-03-25 Thread Parsons Technical Services
Gordon,

Just for grins and giggles try adding this as a test:

 parameter
  nameremoveAbandoned/name
  valuetrue/value
  /parameter

  parameter
  nameremoveAbandonedTimeout/name
  value60/value
  /parameter

To reclaim abandoned connections.

If it drops you back to the min then you have a leak in you app.

Check that connections, resultsets and statements are all closed.

Doug

- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:18 PM
Subject: RE: Connection Pool setup.


 Here my setting...
 
 My problem is ... Connection pool look like don't open 10 connection at
 start-up, and when my servlet run for a while... Let it open up more
 connections(over 30) and then wait... (after a night .. :-D)... When I
 check database server, it still open more connections, I expect min. for
 10 only.
 
 My setup anything got wrong?  Thx.
 ---8
 ?xml version='1.0' encoding='utf-8'?
 ...
 ResourceParams name=jdbc/myjdniname
 parameter
 namefactory/name
  
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
 !-- Maximum number of dB connections in pool. Make sure you
  configure your mysqld max_connections large enough to handle
  all of your db connections. Set to 0 for no limit.
  --
 parameter
 namemaxActive/name
 value100/value
 /parameter
 !-- Maximum number of idle dB connections to retain in pool.
  Set to 0 for no limit.
  --
 parameter
 namemaxIdle/name
 value10/value
 /parameter
 parameter
 nameminIdle/name
 value10/value
 /parameter
 !-- Maximum time to wait for a dB connection to become
 available
  in ms, in this example 10 seconds. An Exception is thrown if
  this timeout is exceeded.  Set to -1 to wait indefinitely.
  --
 parameter
 namemaxWait/name
 value1/value
 /parameter
 parameter
 nameusername/name
 valuemyuserid/value
 /parameter
 parameter
 namepassword/name
 valuemypassword/value
 /parameter
 !-- Class name for mm.mysql JDBC driver --
 parameter
 namedriverClassName/name
 valuenet.sourceforge.jtds.jdbc.Driver/value
 /parameter
 parameter
 nameurl/name
 value 
  
 jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value
 /parameter
 parameter
 namevalidationQuery/name
 valueselect count(*) from tablename/value
 /parameter
 parameter
 nametestOnBorrow/name
 valuetrue/value
 /parameter
 parameter
 nametestWhileIdle/name
 valuetrue/value
 /parameter
 parameter
 nametimeBetweenEvictionRunsMillis/name
 value5000/value
 /parameter
 parameter
 nameminEvictableIdleTimeMillis/name
 value1/value
 /parameter
 /ResourceParams
 
 /Context
 ---8
 
 Regards,
 
 Gordon Luk
 
 
 
 -Original Message-
 From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, March 25, 2004 7:03 PM
 To: Tomcat Users List; Tomcat Users List
 Subject: RE: Connection Pool setup.
 
 
 May help if you post your resource snipplet (replacing any host
 /user/passwd info)
 
  -Original Message-
 From: Gordon Luk [mailto:[EMAIL PROTECTED]
 Sent: Thu Mar 25 05:30:56 2004
 To: Tomcat Users List
 Subject: Connection Pool setup.
 
 Hi All,
 
 May be I missing understand the DBCP configuration. Anyone could
 help ? I want my connection pool are Max 100 connection, 10 conn. At
 start-up, max idle 10, when idle for 10 min then kill it. Something like
 that.
 
Thanks.
 
 
 Regards,
 
 Gordon Luk
 
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 ---
 Incoming mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
  
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
  
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail

Re: Connection Pool setup.

2004-03-25 Thread Gordon Luk
Hi Doug,

   O, thanks, it's work... BTW, thanks for remind, and i am the good 
citizen, allway return connection back to pool. ;-) 

Gordon

Parsons Technical Services wrote:

Gordon,

Just for grins and giggles try adding this as a test:

parameter
 nameremoveAbandoned/name
 valuetrue/value
 /parameter
 parameter
 nameremoveAbandonedTimeout/name
 value60/value
 /parameter
To reclaim abandoned connections.

If it drops you back to the min then you have a leak in you app.

Check that connections, resultsets and statements are all closed.

Doug

- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: 'Tomcat Users List' [EMAIL PROTECTED]
Sent: Thursday, March 25, 2004 11:18 PM
Subject: RE: Connection Pool setup.

 

Here my setting...

My problem is ... Connection pool look like don't open 10 connection at
start-up, and when my servlet run for a while... Let it open up more
connections(over 30) and then wait... (after a night .. :-D)... When I
check database server, it still open more connections, I expect min. for
10 only.
My setup anything got wrong?  Thx.
---8
?xml version='1.0' encoding='utf-8'?
...
   ResourceParams name=jdbc/myjdniname
   parameter
   namefactory/name
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
   /parameter
   !-- Maximum number of dB connections in pool. Make sure you
configure your mysqld max_connections large enough to handle
all of your db connections. Set to 0 for no limit.
--
   parameter
   namemaxActive/name
   value100/value
   /parameter
   !-- Maximum number of idle dB connections to retain in pool.
Set to 0 for no limit.
--
   parameter
   namemaxIdle/name
   value10/value
   /parameter
   parameter
   nameminIdle/name
   value10/value
   /parameter
   !-- Maximum time to wait for a dB connection to become
available
in ms, in this example 10 seconds. An Exception is thrown if
this timeout is exceeded.  Set to -1 to wait indefinitely.
--
   parameter
   namemaxWait/name
   value1/value
   /parameter
   parameter
   nameusername/name
   valuemyuserid/value
   /parameter
   parameter
   namepassword/name
   valuemypassword/value
   /parameter
   !-- Class name for mm.mysql JDBC driver --
   parameter
   namedriverClassName/name
   valuenet.sourceforge.jtds.jdbc.Driver/value
   /parameter
   parameter
   nameurl/name
   value 

jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value
   /parameter
   parameter
   namevalidationQuery/name
   valueselect count(*) from tablename/value
   /parameter
   parameter
   nametestOnBorrow/name
   valuetrue/value
   /parameter
   parameter
   nametestWhileIdle/name
   valuetrue/value
   /parameter
   parameter
   nametimeBetweenEvictionRunsMillis/name
   value5000/value
   /parameter
   parameter
   nameminEvictableIdleTimeMillis/name
   value1/value
   /parameter
   /ResourceParams

/Context
---8
Regards,

Gordon Luk



-Original Message-
From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 25, 2004 7:03 PM
To: Tomcat Users List; Tomcat Users List
Subject: RE: Connection Pool setup.

May help if you post your resource snipplet (replacing any host
/user/passwd info)
-Original Message-
From: Gordon Luk [mailto:[EMAIL PROTECTED]
Sent: Thu Mar 25 05:30:56 2004
To: Tomcat Users List
Subject: Connection Pool setup.
Hi All,

   May be I missing understand the DBCP configuration. Anyone could
help ? I want my connection pool are Max 100 connection, 10 conn. At
start-up, max idle 10, when idle for 10 min then kill it. Something like
that.
  Thanks.

Regards,

Gordon Luk



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.639 / Virus Database: 408 - Release Date: 3/22/2004


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

Re: Connection Pool setup.

2004-03-25 Thread Parsons Technical Services
Gordon,

What about resultset and statement? Since this fixes it then you DO have a
leak. Break it down and check each step to make sure that they are returned,
even if an exception is thrown. I have it in finally clauses as a last
resort if it fails normally. There is something leaving the connection
hanging.

Doug
- Original Message - 
From: Gordon Luk [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Friday, March 26, 2004 2:31 AM
Subject: Re: Connection Pool setup.


 Hi Doug,

 O, thanks, it's work... BTW, thanks for remind, and i am the good
 citizen, allway return connection back to pool. ;-)

 Gordon

 Parsons Technical Services wrote:

 Gordon,
 
 Just for grins and giggles try adding this as a test:
 
  parameter
   nameremoveAbandoned/name
   valuetrue/value
   /parameter
 
   parameter
   nameremoveAbandonedTimeout/name
   value60/value
   /parameter
 
 To reclaim abandoned connections.
 
 If it drops you back to the min then you have a leak in you app.
 
 Check that connections, resultsets and statements are all closed.
 
 Doug
 
 - Original Message - 
 From: Gordon Luk [EMAIL PROTECTED]
 To: 'Tomcat Users List' [EMAIL PROTECTED]
 Sent: Thursday, March 25, 2004 11:18 PM
 Subject: RE: Connection Pool setup.
 
 
 
 
 Here my setting...
 
 My problem is ... Connection pool look like don't open 10 connection at
 start-up, and when my servlet run for a while... Let it open up more
 connections(over 30) and then wait... (after a night .. :-D)... When I
 check database server, it still open more connections, I expect min. for
 10 only.
 
 My setup anything got wrong?  Thx.
 ---8
 ?xml version='1.0' encoding='utf-8'?
 ...
 ResourceParams name=jdbc/myjdniname
 parameter
 namefactory/name
 
 valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter
 !-- Maximum number of dB connections in pool. Make sure you
  configure your mysqld max_connections large enough to handle
  all of your db connections. Set to 0 for no limit.
  --
 parameter
 namemaxActive/name
 value100/value
 /parameter
 !-- Maximum number of idle dB connections to retain in pool.
  Set to 0 for no limit.
  --
 parameter
 namemaxIdle/name
 value10/value
 /parameter
 parameter
 nameminIdle/name
 value10/value
 /parameter
 !-- Maximum time to wait for a dB connection to become
 available
  in ms, in this example 10 seconds. An Exception is thrown if
  this timeout is exceeded.  Set to -1 to wait indefinitely.
  --
 parameter
 namemaxWait/name
 value1/value
 /parameter
 parameter
 nameusername/name
 valuemyuserid/value
 /parameter
 parameter
 namepassword/name
 valuemypassword/value
 /parameter
 !-- Class name for mm.mysql JDBC driver --
 parameter
 namedriverClassName/name
 valuenet.sourceforge.jtds.jdbc.Driver/value
 /parameter
 parameter
 nameurl/name
 value
 
 jdbc:jtds:sqlserver://myserver/mydatabase;TDS=4.2;charset=big5/value
 /parameter
 parameter
 namevalidationQuery/name
 valueselect count(*) from tablename/value
 /parameter
 parameter
 nametestOnBorrow/name
 valuetrue/value
 /parameter
 parameter
 nametestWhileIdle/name
 valuetrue/value
 /parameter
 parameter
 nametimeBetweenEvictionRunsMillis/name
 value5000/value
 /parameter
 parameter
 nameminEvictableIdleTimeMillis/name
 value1/value
 /parameter
 /ResourceParams
 
 /Context
 ---8
 
 Regards,
 
 Gordon Luk
 
 
 
 -Original Message-
 From: D'Alessandro, Arthur [mailto:[EMAIL PROTECTED]
 Sent: Thursday, March 25, 2004 7:03 PM
 To: Tomcat Users List; Tomcat Users List
 Subject: RE: Connection Pool setup.
 
 
 May help if you post your resource snipplet (replacing any host
 /user/passwd info)
 
  -Original Message-
 From: Gordon Luk [mailto:[EMAIL PROTECTED]
 Sent: Thu Mar 25 05:30:56 2004
 To: Tomcat Users List
 Subject: Connection Pool setup.
 
 Hi All,
 
 May be I missing understand the DBCP configuration. Anyone could
 help ? I want my connection pool are Max 100 connection, 10 conn. At
 start-up, max idle 10, when idle for 10 min then kill it. Something like
 that.
 
Thanks.
 
 
 Regards,
 
 Gordon Luk
 
 
 
 ---
 Outgoing mail is certified Virus Free.
 Checked by AVG anti-virus system (http://www.grisoft.com).
 Version: 6.0.639 / Virus Database

RE: Connection pool exhausted

2004-01-09 Thread Chakravarthy, Sundar
Did you check the logs for abandoned ones? I was able to successfully
trace unclosed Oracle connections with the help of db-commons auto
logging feature. But first you have to make sure all your API is using
jdbc/theDB resource to open connections.


-Original Message-
From: Allistair Crossley [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 09, 2004 12:33 PM
To: TOMCAT USER (E-mail)
Subject: Connection pool exhausted

Hi All,

My tomcat is chucking a connection pool exhausted at me after about 15
minutes of operations on my web application. 

Here is my resource;

   Resource name=jdbc/theDB auth=Container
type=javax.sql.DataSource/

   ResourceParams name=jdbc/theDB
parameter  
  namefactory/name  
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value

/parameter
  parameter  
   namedriverClassName/name  
   valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value

  /parameter
  parameter 
nameurl/name  
valuejdbc:microsoft:sqlserver://server:1433/value

  /parameter
  parameter  
 nameusername/name  
 valuesa/value   
   /parameter
   parameter  
 namepassword/name  
 valuepassword/value
   /parameter
   parameter  
 namemaxActive/name  
 value50/value
   /parameter
   parameter  
   namemaxIdle/name  
   value10/value
   /parameter
   parameter  
   namemaxWait/name  
   value1/value
   /parameter
   parameter
   namevalidationQuery/name
   valueSELECT 1 + 1/value
   /parameter
parameternamelogAbandoned/namevaluetrue/value/parameter
parameternameremoveAbandoned/namevaluetrue/value/parameter

/ResourceParams

I have checked that all my code have finally blocks to close result
sets, connections and statements.

I have also checked my SQL server monitors and it shows the connections
are all idle. 

Any starter tips on this problem?

Cheers, ADC


FONT SIZE=1 FACE=VERDANA,ARIAL COLOR=BLUE 
---
QAS Ltd.
Developers of QuickAddress Software
a href=http://www.qas.com;www.qas.com/a
Registered in England: No 2582055
Registered in Australia: No 082 851 474
---
/FONT


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


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



Re: Connection Pool / Connection Bean ?

2003-08-14 Thread Rick Roberts
That looks like exactly what I am after.
I never paid much attention to Jakarta-Commons before.
Thanks for pointing it out :)
--
***
* Rick Roberts*
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com  *
***
Shapira, Yoav wrote:
Howdy,
Sure thing: I like DBCP a lot.  Its home page is here:
http://jakarta.apache.org/commons/dbcp/
And tomcat-specific DBCP how-to is here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples
-howto.html
Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Rick Roberts [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 9:21 AM
To: Tomcat Users List
Subject: Re: Connection Pool / Connection Bean ?
Possibly.  Can you point me to it, so I can read up on it?

I have some old JDBC apps, originally written under Tomcat 3.1 or 3.2.

I'm looking for a relatively painless way to modernize my JDBC
connection

techniques.

Thanks

--
***
* Rick Roberts*
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com  *
***
Shapira, Yoav wrote:

Howdy,
You mean a connection pool like DBCP?
Yoav Shapira
Millennium ChemInformatics



-Original Message-
From: Rick Roberts [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 3:52 PM
To: Tomcat Users List
Subject: Connection Pool / Connection Bean ?
Is there a good, free ConnectionPool, ConnectionBean available?



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


RE: Connection Pool / Connection Bean ?

2003-08-14 Thread Shapira, Yoav

Howdy,
You mean a connection pool like DBCP?

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Rick Roberts [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 3:52 PM
To: Tomcat Users List
Subject: Connection Pool / Connection Bean ?


Is there a good, free ConnectionPool, ConnectionBean available?

--
***
* Rick Roberts*
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com  *
***


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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



RE: Connection Pool / Connection Bean ?

2003-08-14 Thread Shapira, Yoav

Howdy,
Sure thing: I like DBCP a lot.  Its home page is here:
http://jakarta.apache.org/commons/dbcp/

And tomcat-specific DBCP how-to is here:
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples
-howto.html

Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Rick Roberts [mailto:[EMAIL PROTECTED]
Sent: Monday, August 11, 2003 9:21 AM
To: Tomcat Users List
Subject: Re: Connection Pool / Connection Bean ?


Possibly.  Can you point me to it, so I can read up on it?

I have some old JDBC apps, originally written under Tomcat 3.1 or 3.2.

I'm looking for a relatively painless way to modernize my JDBC
connection
techniques.

Thanks

--
***
* Rick Roberts*
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com  *
***

Shapira, Yoav wrote:
 Howdy,
 You mean a connection pool like DBCP?

 Yoav Shapira
 Millennium ChemInformatics



-Original Message-
From: Rick Roberts [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 3:52 PM
To: Tomcat Users List
Subject: Connection Pool / Connection Bean ?


Is there a good, free ConnectionPool, ConnectionBean available?



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




This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


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



Re: Connection Pool / Connection Bean ?

2003-08-14 Thread Rick Roberts
Possibly.  Can you point me to it, so I can read up on it?

I have some old JDBC apps, originally written under Tomcat 3.1 or 3.2.

I'm looking for a relatively painless way to modernize my JDBC connection 
techniques.

Thanks

--
***
* Rick Roberts*
* Advanced Information Technologies, Inc. *
* http://www.ait-web.com  *
***
Shapira, Yoav wrote:
Howdy,
You mean a connection pool like DBCP?
Yoav Shapira
Millennium ChemInformatics


-Original Message-
From: Rick Roberts [mailto:[EMAIL PROTECTED]
Sent: Sunday, August 10, 2003 3:52 PM
To: Tomcat Users List
Subject: Connection Pool / Connection Bean ?
Is there a good, free ConnectionPool, ConnectionBean available?



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


RE: connection pool recreated

2003-07-28 Thread Mike Curwen
Didn't know you were going to start a new thread.. see my question under
the previous one.  The DataSource in your code is NOT the pool.

 -Original Message-
 From: Hans Wichman [mailto:[EMAIL PROTECTED] 
 Sent: Monday, July 28, 2003 9:45 AM
 To: [EMAIL PROTECTED]
 Subject: connection pool recreated
 
 
 Hi,
 this is a repost of an earlier post, which I hope is a bit 
 clearer. Why, if I run:
  Context ctx = new InitialContext();
  if(ctx == null ) throw new ServletException(Boom - 
 No Context);
  ds =
(DataSource)ctx.lookup(java:comp/env/jdbc/SEDDB);
 under tomcat 4.0.1 is a NEW DataSource object returned 
 everytime? I thought the idea was to have one pool created on 
 context load that can be 
 accessed through the initial context,
 but instead a new db pool is returned after each such call...
 
 Hope someone can help...
 
 Greetz
 Hans
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



RE: connection pool recreated

2003-07-28 Thread Hans Wichman
I am sorry, I thought I was out of luck on that one ;-(, let's kill this 
thread, I have replied to your other post.
Thanks !

At 09:47 AM 7/28/2003 -0500, Mike Curwen wrote:
Didn't know you were going to start a new thread.. see my question under
the previous one.  The DataSource in your code is NOT the pool.
 -Original Message-
 From: Hans Wichman [mailto:[EMAIL PROTECTED]
 Sent: Monday, July 28, 2003 9:45 AM
 To: [EMAIL PROTECTED]
 Subject: connection pool recreated


 Hi,
 this is a repost of an earlier post, which I hope is a bit
 clearer. Why, if I run:
  Context ctx = new InitialContext();
  if(ctx == null ) throw new ServletException(Boom -
 No Context);
  ds =
(DataSource)ctx.lookup(java:comp/env/jdbc/SEDDB);
 under tomcat 4.0.1 is a NEW DataSource object returned
 everytime? I thought the idea was to have one pool created on
 context load that can be
 accessed through the initial context,
 but instead a new db pool is returned after each such call...

 Hope someone can help...

 Greetz
 Hans


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

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


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


RE: connection pool

2003-03-28 Thread Raible, Matt
I've seen this same issue and I'm interested in a solution as well.

Thanks,

Matt

 -Original Message-
 From: Salina Cheung [mailto:[EMAIL PROTECTED]
 Sent: Friday, March 28, 2003 9:00 AM
 To: [EMAIL PROTECTED]
 Subject: connection pool
 
 
 Hi, 
 
 When tomcat reloads class files, it also reinitialize
 the context and the connection pool.  But if there are
 users hitting the site, the connections dont get
 closed property. These connections still connects to
 the DB server, but not usable in the newly intialized
 connection pool.
 
 I tried to close the connections in detroy method of
 servlet, but it is too later by the time destroy
 method of servlet is called.
 
 Please help.
 
 I have tomcat 4.1.18, a cluster of 15 instances. Each
 instance has max active connection of 55.
 
 This bug causes total number of connections to the DB
 exceeds total number of connections a dB server can
 take.
 
 Salina
 
 
 
 
 
 __
 Do you Yahoo!?
 Yahoo! Platinum - Watch CBS' NCAA March Madness, live on your desktop!
 http://platinum.yahoo.com
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 


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



RE: Connection Pool problem with virtual hosts

2003-01-09 Thread Roberts, Eric
Hi,

Try using the GlobalNamingResource element instead of the Context element, then put a 
ResourceLink to that resource in each Host element.

If the resource is defined in either Context or GlobalNamingResource in server.xml , 
there is no need to include any reference to it in web.xml as a lookup to the 
InitialContext will resolve the resource.

Regards

Eric

-Original Message-
From: Nate Drake [mailto:[EMAIL PROTECTED]]
Sent: Donnerstag, 09. Jänner 2003 15:48
To: [EMAIL PROTECTED]
Subject: Connection Pool problem with virtual hosts


Hi,

I'm having trouble when attempting to access a JDBC connection pool when
using a virtual host.  I have a servlet that is set to load on startup (ie.
load-on-startup1/load-on-startup in web.xml), this servlet attempts to
get a pool connection to read some configuration options from the database.
This works fine when the web app is deploy without using virtual hosts.
When attempting to run with virtual hosts I get the following error: Could
not load JDBC driver 'null'.  I've seen this error reported many times on
the list, with no definite solution that has worked.

Here is information about my setup:

Tomcat Standalone, version 4.1.12

Oracle database

Solaris 8 and 9

web.xml for pool:

resource-ref
  descriptionOracle Datasource/description
  res-ref-namejdbc/orapool/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

server.xml for virtual host:

  Host name=blah.blah.com debug=0 appBase=blah
   unpackWARs=true autoDeploy=true

!-- Logger shared by all Contexts related to this virtual host.  By
 default (when using FileLogger), log files are created in the
logs
 directory relative to $CATALINA_HOME.  If you wish, you can
specify
 a different directory with the directory attribute.  Specify
either a
 relative (to $CATALINA_HOME) or absolute path to the desired
 directory.--
Logger className=org.apache.catalina.logger.FileLogger
 directory=logs  prefix=blah_log. suffix=.txt
timestamp=true/

!-- Define properties for each web application.  This is only
needed
 if you want to set non-default properties, or have web
application
 document roots in places other than the virtual host's appBase
 directory.  --

!-- Tomcat Root Context --
  Context path= docBase=blahweb debug=4

Resource name=jdbc/orapool auth=Container
  type=javax.sql.DataSource/

ResourceParams name=jdbc/orapool
parameter
namefactory/name

valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter
parameter
namedriverClassName/name
valueoracle.jdbc.driver.OracleDriver/value
/parameter
parameter
namevalidationQuery/name
valueselect sysdate from dual/value
/parameter
parameter
nameremoveAbandoned/name
valuetrue/value
/parameter
parameter
nameremoveAbandonedTimeout/name
value60/value
/parameter
parameter
namelogAbandoned/name
valuetrue/value
/parameter
parameter
namemaxWait/name
value3/value
/parameter
parameter
namemaxActive/name
value20/value
/parameter
parameter
namemaxIdle/name
value10/value
/parameter
parameter
namepassword/name
valuemypassword/value
/parameter
parameter
nameurl/name

valuejdbc:oracle:thin:@192.168.0.100:1521:mysid/value
/parameter
parameter
nameusername/name
valuemyusername/value
/parameter
/ResourceParams
 /Context
  /Host

Code to get connection from pool:

Context envContext  = (Context)initContext.lookup(java:/comp/env);
DataSource ds = (DataSource)envContext.lookup(jdbc/orapool);
return ds.getConnection();


Again, the above configuration works fine when used in a Context under the
localhost Host element.  It seems to only be when I define another
Host element that I get the error.


Any ideas?

Thanks,

Nate


--
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 

Re: Connection Pool

2003-01-06 Thread Nick Stuart
what db are you using? I know in MySQL you can simple do a query such
as:
show processlist
in the mysql client. You can see all the connections that are currently
active. Of course this wont tell you which ones are in use, but you can
kinda figure that out by the amount of time that the thread as been
asleep.
A better way to view this info is with the perl program mytop. works
just like the top command in linux.
Hope this helps.

-Nick

On Mon, 2003-01-06 at 14:23, Hari Venkatesan wrote:
 Is there a way to find out the number of active connections in a
 connection pool?
  
 Hari

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




Re: connection pool to postgresql

2002-12-06 Thread Alexander Wallace
Here is what i have in server.xml in the context of my app

Resource name=jdbc/postgresql auth=Container
type=javax.sql.DataSource/ 
ResourceParams name=jdbc/postgresql
  parameter
namefactory/name
   
valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
  /parameter
  parameter
namedriverClassName/name
valueorg.postgresql.Driver/value
  /parameter
  parameter
nameurl/name
   
valuejdbc:postgresql://IP.GOES.HERE.XX/db_name_goes_here/value
  /parameter
  parameter
nameusername/name
valueTheUserNameGoesHere/value
  /parameter
  parameter
namepassword/name
valueThePasswordGoesHere/value
  /parameter
  parameter
namemaxActive/name
value50/value
  /parameter
  parameter
namemaxIdle/name
value10/value
  /parameter
  parameter
namemaxWait/name
value-1/value
  /parameter
/ResourceParams 

then my web.xml

  resource-ref
descriptionpostgreSQL Datasource/description
res-ref-namejdbc/postgresql/res-ref-name
res-typejavax.sql.DataSource/res-type
res-authContainer/res-auth
  /resource-ref

The following class provides connections from the pool:

import java.sql.Connection;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

/**
 * Class Pool provides pooled connections from JNDI data source.
 * 
 */
public class Pool {

/**
 * Method Pool creates a database pool
 */
public Pool() {
System.err.println(Pool Initialized);
}

/**
 * Method getConnection.
 * @return Connection 
 */
public static Connection getConnection() {

Connection cn = null;

try {
Context ctx = new InitialContext();
DataSource ds =
(DataSource)ctx.lookup(java:comp/env/jdbc/postgresql);
if (ds != null) { 
cn = ds.getConnection();
}
}
catch (Exception e) {
e.printStackTrace(System.err);
}

return cn;
}
}

And to get a connection and use it, just declare like:

Connection cn = Pool.getConnection();

And that's it!

On Fri, 2002-12-06 at 16:11, Dionisio Ruiz de Zarate wrote:
 Hello can anybody help me to configure one connection pool to postgresql
 from tomcat?
 and how can i use fron one java class?
 thanks
 
 
 
 --
 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]




Re: connection pool to postgresql

2002-12-06 Thread Craig R. McClanahan


On Fri, 6 Dec 2002, Dionisio Ruiz de Zarate wrote:

 Date: Fri, 6 Dec 2002 23:11:37 +0100
 From: Dionisio Ruiz de Zarate [EMAIL PROTECTED]
 Reply-To: Tomcat Users List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: connection pool to postgresql

 Hello can anybody help me to configure one connection pool to postgresql
 from tomcat?
 and how can i use fron one java class?
 thanks



Configuration examples are in the docs shipped with Tomcat, or available
online:

http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html

which also includes example code for accessing and using the connection
pool.  Note that the application level code is basically independent of
what actual database you're using under the covers.

Craig



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




Re: Connection pool question:

2002-11-06 Thread Ricardo Moral
Send us the code of the DBQuery.java. (The shorter the
better)


--- Michael Nicholson [EMAIL PROTECTED] wrote:
 I'm building a webapp, and I want to use connection
 pooling with it.  In order to play around some, I
 made a dummy webapp that does virtually nothing, but
 uses the connection pool.  So then I cut and pasted
 some code out into the bigger webapp, but now I get
 this error:
 
 MonitorFilter::java.lang.ClassCastException:
 org.apache.commons.dbcp.BasicDataSource
 at CPPSDB.DBQuery.init(DBQuery.java:34)
 at

org.apache.jsp.Login$jsp._jspService(Login$jsp.java:127)
 at

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:174)
 at

org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:247)
 at

org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
 at

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
 at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
 at

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:223)
 at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
 at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
 at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 at

org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 at

org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 at

org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:142)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at

org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
 at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 at

org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 at

org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
 at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
 at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
 at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at

org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
 at

org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
 at java.lang.Thread.run(Thread.java:536)
 
 My server.xml has the same resource and resource
 params for both contexts, and my web.xml has the
 same resource-ref as the dummy app, but I still get
 the same error.  Any ideas?
 
 Michael Nicholsn


__
Do you Yahoo!?
HotJobs - Search new jobs daily now
http://hotjobs.yahoo.com/

--
To unsubscribe, e-mail:   mailto:tomcat-user-unsubscribe;jakarta.apache.org
For 

Re: Connection pool question:

2002-11-06 Thread Michael Nicholson
The Code of DBQuery follows:  Remember, in one webapp, it works fine, in
another, it gives a class cast exception at the ***'d line



begin code snippet
/*
 * DBQuery.java
 *
 * Created on November 5, 2002, 10:14 AM
 */

package DBCPTestClasses;

import java.sql.*;
import javax.naming.*;
import javax.sql.*;

/**
 *
 * author  man
 */
public class DBQuery
{
  Context initContext = null;
  Context envContext = null;
  DataSource ds = null;
  Connection con = null;
  Statement stmt = null;
  ResultSet rs = null;

  /** Creates a new instance of DBQuery */
  public DBQuery() throws NamingException
  {
initContext = new InitialContext();
envContext  = (Context)initContext.lookup(java:comp/env);
ds = (DataSource) envContext.lookup(jdbc/myoracle);   //***- Class
Cast Exception Occurs Here
  }

  /**
   * Runs an SQL Query and returns the results as a resultset
   * returns ResultSet
   */
  public ResultSet select(String SQLStr) throws SQLException
  {
con = ds.getConnection();
stmt =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_
ONLY);
rs = stmt.executeQuery(SQLStr);
return rs;
  }

  /**
   * Closes all connections and such
   */
  public boolean close()
  {
try
{
  rs.close();
  rs = null;
  stmt.close();
  stmt = null;
  con.close();
  con = null;
  return true;
} catch (SQLException ex) {
  throw new RuntimeException(There was an error closing the connection
variables--   + ex.getMessage());
} finally {
  if(rs!=null) rs = null;
  if(stmt!=null) stmt = null;
  if(con!=null) con = null;
}
  }
}
/End Code Snippet

So that's it.  Any insight?  Thanks...

Mike


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




Re: Connection pool question:

2002-11-06 Thread Michael Nicholson
I'm running it through Forte/SunOneStudio, which is built on netbeans (I
think).  Does that make a difference?


- Original Message -
From: Kwok Peng Tuck [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, November 05, 2002 8:03 PM
Subject: Re: Connection pool question:


 Are you running the tomcat which is built into Netbeans ?


 Michael Nicholson wrote:

 I'm building a webapp, and I want to use connection pooling with it.  In
order to play around some, I made a dummy webapp that does virtually
nothing, but uses the connection pool.  So then I cut and pasted some code
out into the bigger webapp, but now I get this error:
 
 MonitorFilter::java.lang.ClassCastException:
org.apache.commons.dbcp.BasicDataSource
 at CPPSDB.DBQuery.init(DBQuery.java:34)
 at org.apache.jsp.Login$jsp._jspService(Login$jsp.java:127)
 at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper
.service(IDEJspServlet.java:174)
 at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(ID
EJspServlet.java:247)
 at
org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspSer
vlet.java:339)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
 at
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter
.java:223)
 at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:213)
 at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
 at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
 at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:528)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
 at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
 at
org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.j
ava:142)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
 at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
 at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
 at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
 at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
 at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
 at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
 at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
 at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1012)
 at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107
)
 at java.lang.Thread.run(Thread.java:536)
 
 My server.xml has the same resource and resource params for both
contexts, and my web.xml has the same resource-ref as the dummy app, but I
still get

Re: Connection pool question:

2002-11-06 Thread Mehdi . Nejad

What are the differences between the jar files that you have in each
/WEB-INF/lib folder ?

Judging by the class cast exception, i'd advise you to try temporarily
removing the jars from your bigger webapps /lib folder, and run the same
code again.

regards,
M




   
 
  Michael 
 
  Nicholson   To:   Tomcat Users List 
[EMAIL PROTECTED]   
  [EMAIL PROTECTED]cc: 
 
  u   Subject:  Re: Connection pool question: 
 
   
 
  06/11/2002 14:11 
 
  Please respond to
 
  Tomcat Users
 
  List
 
   
 
   
 




The Code of DBQuery follows:  Remember, in one webapp, it works fine, in
another, it gives a class cast exception at the ***'d line



begin code snippet
/*
 * DBQuery.java
 *
 * Created on November 5, 2002, 10:14 AM
 */

package DBCPTestClasses;

import java.sql.*;
import javax.naming.*;
import javax.sql.*;

/**
 *
 * @author  man
 */
public class DBQuery
{
  Context initContext = null;
  Context envContext = null;
  DataSource ds = null;
  Connection con = null;
  Statement stmt = null;
  ResultSet rs = null;

  /** Creates a new instance of DBQuery */
  public DBQuery() throws NamingException
  {
initContext = new InitialContext();
envContext  = (Context)initContext.lookup(java:comp/env);
ds = (DataSource) envContext.lookup(jdbc/myoracle);   //***- Class
Cast Exception Occurs Here
  }

  /**
   * Runs an SQL Query and returns the results as a resultset
   * @returns ResultSet
   */
  public ResultSet select(String SQLStr) throws SQLException
  {
con = ds.getConnection();
stmt =
con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_

ONLY);
rs = stmt.executeQuery(SQLStr);
return rs;
  }

  /**
   * Closes all connections and such
   */
  public boolean close()
  {
try
{
  rs.close();
  rs = null;
  stmt.close();
  stmt = null;
  con.close();
  con = null;
  return true;
} catch (SQLException ex) {
  throw new RuntimeException(There was an error closing the connection
variables--   + ex.getMessage());
} finally {
  if(rs!=null) rs = null;
  if(stmt!=null) stmt = null;
  if(con!=null) con = null;
}
  }
}
/End Code Snippet

So that's it.  Any insight?  Thanks...

Mike


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






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




Re: Connection pool question:

2002-11-06 Thread Ricardo Moral
Sorry but I cant't find nothing wrong... Please send
the part of the server.xml and web.xml files where you
have defined the references. Are you sure there are no
diferences between the two web applications?

--- Michael Nicholson [EMAIL PROTECTED] wrote:
 I'm running it through Forte/SunOneStudio, which is
 built on netbeans (I
 think).  Does that make a difference?
 
 
 - Original Message -
 From: Kwok Peng Tuck [EMAIL PROTECTED]
 To: Tomcat Users List
 [EMAIL PROTECTED]
 Sent: Tuesday, November 05, 2002 8:03 PM
 Subject: Re: Connection pool question:
 
 
  Are you running the tomcat which is built into
 Netbeans ?
 
 
  Michael Nicholson wrote:
 
  I'm building a webapp, and I want to use
 connection pooling with it.  In
 order to play around some, I made a dummy webapp
 that does virtually
 nothing, but uses the connection pool.  So then I
 cut and pasted some code
 out into the bigger webapp, but now I get this
 error:
  
  MonitorFilter::java.lang.ClassCastException:
 org.apache.commons.dbcp.BasicDataSource
  at CPPSDB.DBQuery.init(DBQuery.java:34)
  at

org.apache.jsp.Login$jsp._jspService(Login$jsp.java:127)
  at

org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
  at

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at

org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper
 .service(IDEJspServlet.java:174)
  at

org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(ID
 EJspServlet.java:247)
  at

org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspSer
 vlet.java:339)
  at

javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
  at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
 FilterChain.java:247)
  at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
 ain.java:193)
  at

org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter
 .java:223)
  at

org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
 FilterChain.java:213)
  at

org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
 ain.java:193)
  at

org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
 va:243)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 66)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at

org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
 va:190)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 66)
  at

org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
 .java:528)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 64)
  at

org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
 46)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 64)
  at

org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.j
 ava:142)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 64)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at

org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
  at

org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
 )
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 66)
  at

org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
 java:170)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 64)
  at

org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
 )
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 64)
  at

org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 64)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
  at

org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
 :174)
  at

org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
 66)
  at

org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
  at

org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943

Re: Connection pool question:

2002-11-06 Thread Michael Nicholson
Thanks... that was kinda my plan for now, but I'm in a rush to get something
running, so my temporary solution is to abandon the connection pool and just
create a connection to the DB each time...  Yay, big performance hit!  Oh
well.  But then I'm gonna start stripping jars

Thanks for the help.

Mike
- Original Message -
From: [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Wednesday, November 06, 2002 9:34 AM
Subject: Re: Connection pool question:



 What are the differences between the jar files that you have in each
 /WEB-INF/lib folder ?

 Judging by the class cast exception, i'd advise you to try temporarily
 removing the jars from your bigger webapps /lib folder, and run the same
 code again.

 regards,
 M





   Michael
   Nicholson   To:   Tomcat Users
List [EMAIL PROTECTED]
   [EMAIL PROTECTED]cc:
   u   Subject:  Re: Connection
pool question:

   06/11/2002 14:11
   Please respond to
   Tomcat Users

   List






 The Code of DBQuery follows:  Remember, in one webapp, it works fine, in
 another, it gives a class cast exception at the ***'d line



 begin code snippet
 /*
  * DBQuery.java
  *
  * Created on November 5, 2002, 10:14 AM
  */

 package DBCPTestClasses;

 import java.sql.*;
 import javax.naming.*;
 import javax.sql.*;

 /**
  *
  * @author  man
  */
 public class DBQuery
 {
   Context initContext = null;
   Context envContext = null;
   DataSource ds = null;
   Connection con = null;
   Statement stmt = null;
   ResultSet rs = null;

   /** Creates a new instance of DBQuery */
   public DBQuery() throws NamingException
   {
 initContext = new InitialContext();
 envContext  = (Context)initContext.lookup(java:comp/env);
 ds = (DataSource) envContext.lookup(jdbc/myoracle);   //***- Class
 Cast Exception Occurs Here
   }

   /**
* Runs an SQL Query and returns the results as a resultset
* @returns ResultSet
*/
   public ResultSet select(String SQLStr) throws SQLException
   {
 con = ds.getConnection();
 stmt =

con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_

 ONLY);
 rs = stmt.executeQuery(SQLStr);
 return rs;
   }

   /**
* Closes all connections and such
*/
   public boolean close()
   {
 try
 {
   rs.close();
   rs = null;
   stmt.close();
   stmt = null;
   con.close();
   con = null;
   return true;
 } catch (SQLException ex) {
   throw new RuntimeException(There was an error closing the
connection
 variables--   + ex.getMessage());
 } finally {
   if(rs!=null) rs = null;
   if(stmt!=null) stmt = null;
   if(con!=null) con = null;
 }
   }
 }
 /End Code Snippet

 So that's it.  Any insight?  Thanks...

 Mike


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






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




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




Re: Connection pool question:

2002-11-05 Thread Kwok Peng Tuck
Are you running the tomcat which is built into Netbeans ?


Michael Nicholson wrote:


I'm building a webapp, and I want to use connection pooling with it.  In order to play around some, I made a dummy webapp that does virtually nothing, but uses the connection pool.  So then I cut and pasted some code out into the bigger webapp, but now I get this error:

MonitorFilter::java.lang.ClassCastException: org.apache.commons.dbcp.BasicDataSource
   at CPPSDB.DBQuery.init(DBQuery.java:34)
   at org.apache.jsp.Login$jsp._jspService(Login$jsp.java:127)
   at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet$JspServletWrapper.service(IDEJspServlet.java:174)
   at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.serviceJspFile(IDEJspServlet.java:247)
   at org.netbeans.modules.tomcat.tomcat40.runtime.IDEJspServlet.service(IDEJspServlet.java:339)
   at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:223)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:528)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
   at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
   at org.netbeans.modules.web.monitor.catalina.MonitorValve.invoke(MonitorValve.java:142)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
   at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2343)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
   at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
   at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
   at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
   at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
   at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1012)
   at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107)
   at java.lang.Thread.run(Thread.java:536)

My server.xml has the same resource and resource params for both contexts, and my web.xml has the same resource-ref as the dummy app, but I still get the same error.  Any ideas?

Michael Nicholsn
 




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




Re: connection pool..

2002-10-21 Thread Jean-Francois Arcand
Please include your errors when you post a question like that. They are 
several solutions, and without the exact exception, it's very hard to 
help you.

-- Jeanfrancois

Sandeep Murphy wrote:

hi all,

I perused the procedure provided for creating and using connection pools (with mysql and other dbs) at http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-howto.html#Common%20Problems  but am stuck for a solution to this problem..

hving followd the procedure step by step and making all necessary changes, as soon as i boot tomcat, i get a number of erros on the tomcat console related to deploying of the naming resource etc..

has anyone faced this problem??

wud appreciate a lot if anyone can help,
thnx in adv,
sands

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


 



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




RE: Connection pool DBCP

2002-10-07 Thread john

I don't know about the particular connection pool you are using, but in
general I believe the mechanism would be similar to that implemented by
Sybase's Jaguar ejb/servlet engine.  There a sanity check is run on each
connection after it has been returned to the pool and before it is re-used.
For Sybase it's select 1 from dummy, for Oracle it could be Select 1 from
dual.  If the database had been restarted then the cached connection would
fail its sanity check and would be released and replaced by a new
connection.  I don't know of any other database independent way of doing
this.

Best Wishes
John Burgess
[EMAIL PROTECTED]
Tel: 01865 718666
Fax: 01865 718600


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Friday, October 04, 2002 4:38 PM
To: tomcat-user
Subject: Connection pool DBCP


I have been seen that nobody is able to answer to this question, I
presume it's interesting for anybody, for a few days.

I wish I knew if DBCP is able to find when db is restarted and
reconnect.

I'd like to use the jakarta instrument DBCP because all the products of
the jakarta community are very good, but the main point is to know if
DBCP can recconect to DB lonely.

Can some answer to this question?

Thanks


Laura


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

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.393 / Virus Database: 223 - Release Date: 30/09/02


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.393 / Virus Database: 223 - Release Date: 30/09/02



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




Re: Connection pool DBCP

2002-10-06 Thread Pae Choi

I have not tested DBCP for this specific one yet, but this is an interesting
one to do down the road.

Just from my top of head, it should not be a difficult challenge. For
example,
you can create a listener that runs with a separate thread to check the
connection heartbeat.

Since 'dbcp' is commonly used with 'pool' package, the question is where
would be an ideal place to place the mechanism. But this is a design issue,
not the feasibility issue. ^^

Regards,


Pae




- Original Message -
From: Nikola Milutinovic [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Saturday, October 05, 2002 3:16 AM
Subject: Re: Connection pool DBCP


 [EMAIL PROTECTED] wrote:

  I have been seen that nobody is able to answer to this question, I
  presume it's interesting for anybody, for a few days.
 
  I wish I knew if DBCP is able to find when db is restarted and
  reconnect.
 
  I'd like to use the jakarta instrument DBCP because all the products of
  the jakarta community are very good, but the main point is to know if
  DBCP can recconect to DB lonely.
 
  Can some answer to this question?

 Don't take my word for it, but I think it cannot. It could be that the
main
 problem is the JDBC interface. Does it have any method to determine if the
DB
 went down and to check if it came up again? Or any way to determine that
JDBC
 connections have been disconnected?

 Nix.


 --
 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]




Re: Connection pool DBCP

2002-10-05 Thread Nikola Milutinovic

[EMAIL PROTECTED] wrote:

 I have been seen that nobody is able to answer to this question, I 
 presume it's interesting for anybody, for a few days.
 
 I wish I knew if DBCP is able to find when db is restarted and 
 reconnect.
 
 I'd like to use the jakarta instrument DBCP because all the products of 
 the jakarta community are very good, but the main point is to know if 
 DBCP can recconect to DB lonely.
 
 Can some answer to this question?

Don't take my word for it, but I think it cannot. It could be that the main 
problem is the JDBC interface. Does it have any method to determine if the DB 
went down and to check if it came up again? Or any way to determine that JDBC 
connections have been disconnected?

Nix.


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




RE: Connection pool DBCP

2002-10-04 Thread Galbraith, Paul

If you need to be absolutely certain, you can configure DBCP to test every connection 
before it is checked out.

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: October 4, 2002 11:38 AM
To: tomcat-user
Subject: Connection pool DBCP


I have been seen that nobody is able to answer to this question, I 
presume it's interesting for anybody, for a few days.

I wish I knew if DBCP is able to find when db is restarted and 
reconnect.

I'd like to use the jakarta instrument DBCP because all the products of 
the jakarta community are very good, but the main point is to know if 
DBCP can recconect to DB lonely.

Can some answer to this question?

Thanks


Laura


--
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]




Re: Connection Pool Not Reusing Connections

2002-10-04 Thread Thaddeus Gean Cowan Thompson


I upgraded to Tomcat 4.1.12 and added the factory parameter to the Context
in server.xml and I started to get Connections from the pool.  Thanks Ej.

 - Thadd

On Thu, 3 Oct 2002 [EMAIL PROTECTED] wrote:


 The below web descriptor does not actually use a Connection Pool since
 you do not define the factory tag to tell Tomcat that the JNDI is a
 Connection pool.
 As of now, it is just generating a new connection every time you request
 one.

 See below for example factory that will work with Tomcat 4.1.10

 parameter
   namefactory/name
   valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
 /parameter


 Tomcat release 4.1.10 and higher comes with the Jakarta Commons Database
 Connection pool.
 If you are using a release lower, you can down load the DBCP from the
 Jakarta site.

 Hope this helps,
 Ej Chambers





 Thaddeus Gean Cowan Thompson [EMAIL PROTECTED] on 10/02/2002
 08:33:04 PM

 Please respond to Tomcat Users List [EMAIL PROTECTED]

 To:[EMAIL PROTECTED]
 cc:

 Subject:Connection Pool Not Reusing Connections



 Tomcat Users -

 I am trying to implement connection pooling.  I seem to be able to get a
 connection from the pool without any problems, by following the steps
 in the Tomcat docs, but it does not seem to reuse any of the connections
 from the pool.  The reason that I believe this is because when I grab a
 connection from the pool I do a toString on it, resulting in someting like
 'org.gjt.mm.mysql.jdbc2.Connection@60bf50', but the same toString never
 appears twice.  In addition after using (creating and closing) about
 3,000 connections in rappid succession I start revieving null pointers
 when I try to obtain a connection from the pool.

 I have edited my web.xml as follows.
 resource-ref
   description
 Reference to the Connection Pool defined in server.xml
   /description
   res-ref-namejdbc/customer/res-ref-name
   res-typejavax.sql.DataSource/res-type
   res-authContainer/res-auth
 /resource-ref

 I have edited my server.xml as follows.
 Context path=/grocery_site
  reloadable=true
  debug=0
  docBase=grocery_site
   Resource name=jdbc/customer
 auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/customer
 parameter
   namedriverClassName/name
   valueorg.gjt.mm.mysql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:mysql://localhost:3306/grocery_customer/value
 /parameter
 parameter
   nameuser/name
   valuegrocery/value
 /parameter
 parameter
   namepassword/name
   valuegrocery/value
 /parameter
   /ResourceParams
   Resource name=jdbc/product
 auth=Container
 type=javax.sql.DataSource/
   ResourceParams name=jdbc/product
 parameter
   namedriverClassName/name
   valueorg.gjt.mm.mysql.Driver/value
 /parameter
 parameter
   namedriverName/name
   valuejdbc:mysql://localhost:3306/grocery_product/value
 /parameter
 parameter
   nameuser/name
   valuegrocery/value
 /parameter
 parameter
   namepassword/name
   valuegrocery/value
 /parameter
   /ResourceParams
 /Context

 I have tried the addion of the maxIdle, maxActive, and removeAbandoned
 parameters to my configuration, but they seemed to have no effect.

 The utility method that is used to get a connection from the pool is as
 follows.  The gc stuff is ran to clean up the Connections that the pool
 seams to be discarding rather then reusing (this is a hack untill I get
 this problem solved).
   private static Connection getPooledConnection(String data_source){
 Connection connection = null;
 try{
   Context context = (Context) new InitialContext().lookup(
   java:comp/env);
   DataSource ds = ((DataSource) context.lookup(data_source));
   connection = ds.getConnection();
 }
 catch(Exception e){
   System.err.println(DatabaseUtil.getPooledConnection():  +
 Unable to retrive connection from pool.  +
 Running System.runFinalization() and System.gc());
   System.runFinalization();
   System.gc();
 }
 return connection;
   }

 In reading some docs I found that I should call ResultSet.close(),
 Statement.close(), and Connection.close() to ensure that the connections
 get reused.  So I have check all my code over for those type of leaks, but
 had no success.  I should mention that all the methods in a single Object
 instance share a Connection between methods (but use a fresh Statement and
 ResultSet for each query/update), and I close the Connection in the
 Object's finalize method as follows.
   protected void finalize() throws Throwable{
 System.out.print(Closing  + connection + ...);
 connection.close();
 System.out.println(connection);
   }

 When executed the method prints somthing like
 Closing org.gjt.mm.mysql.jdbc2.Connection@60bf50 ...
 org.gjt.mm.mysql.jdbc2.Connection@60bf50


 I should also 

Re: Connection Pool Not Reusing Connections

2002-10-03 Thread echambe1


The below web descriptor does not actually use a Connection Pool since
you do not define the factory tag to tell Tomcat that the JNDI is a
Connection pool.
As of now, it is just generating a new connection every time you request
one.

See below for example factory that will work with Tomcat 4.1.10

parameter
  namefactory/name
  valueorg.apache.commons.dbcp.BasicDataSourceFactory/value
/parameter


Tomcat release 4.1.10 and higher comes with the Jakarta Commons Database
Connection pool.
If you are using a release lower, you can down load the DBCP from the
Jakarta site.

Hope this helps,
Ej Chambers





Thaddeus Gean Cowan Thompson [EMAIL PROTECTED] on 10/02/2002
08:33:04 PM

Please respond to Tomcat Users List [EMAIL PROTECTED]

To:[EMAIL PROTECTED]
cc:

Subject:Connection Pool Not Reusing Connections



Tomcat Users -

I am trying to implement connection pooling.  I seem to be able to get a
connection from the pool without any problems, by following the steps
in the Tomcat docs, but it does not seem to reuse any of the connections
from the pool.  The reason that I believe this is because when I grab a
connection from the pool I do a toString on it, resulting in someting like
'org.gjt.mm.mysql.jdbc2.Connection@60bf50', but the same toString never
appears twice.  In addition after using (creating and closing) about
3,000 connections in rappid succession I start revieving null pointers
when I try to obtain a connection from the pool.

I have edited my web.xml as follows.
resource-ref
  description
Reference to the Connection Pool defined in server.xml
  /description
  res-ref-namejdbc/customer/res-ref-name
  res-typejavax.sql.DataSource/res-type
  res-authContainer/res-auth
/resource-ref

I have edited my server.xml as follows.
Context path=/grocery_site
 reloadable=true
 debug=0
 docBase=grocery_site
  Resource name=jdbc/customer
auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/customer
parameter
  namedriverClassName/name
  valueorg.gjt.mm.mysql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:mysql://localhost:3306/grocery_customer/value
/parameter
parameter
  nameuser/name
  valuegrocery/value
/parameter
parameter
  namepassword/name
  valuegrocery/value
/parameter
  /ResourceParams
  Resource name=jdbc/product
auth=Container
type=javax.sql.DataSource/
  ResourceParams name=jdbc/product
parameter
  namedriverClassName/name
  valueorg.gjt.mm.mysql.Driver/value
/parameter
parameter
  namedriverName/name
  valuejdbc:mysql://localhost:3306/grocery_product/value
/parameter
parameter
  nameuser/name
  valuegrocery/value
/parameter
parameter
  namepassword/name
  valuegrocery/value
/parameter
  /ResourceParams
/Context

I have tried the addion of the maxIdle, maxActive, and removeAbandoned
parameters to my configuration, but they seemed to have no effect.

The utility method that is used to get a connection from the pool is as
follows.  The gc stuff is ran to clean up the Connections that the pool
seams to be discarding rather then reusing (this is a hack untill I get
this problem solved).
  private static Connection getPooledConnection(String data_source){
Connection connection = null;
try{
  Context context = (Context) new InitialContext().lookup(
  java:comp/env);
  DataSource ds = ((DataSource) context.lookup(data_source));
  connection = ds.getConnection();
}
catch(Exception e){
  System.err.println(DatabaseUtil.getPooledConnection():  +
Unable to retrive connection from pool.  +
Running System.runFinalization() and System.gc());
  System.runFinalization();
  System.gc();
}
return connection;
  }

In reading some docs I found that I should call ResultSet.close(),
Statement.close(), and Connection.close() to ensure that the connections
get reused.  So I have check all my code over for those type of leaks, but
had no success.  I should mention that all the methods in a single Object
instance share a Connection between methods (but use a fresh Statement and
ResultSet for each query/update), and I close the Connection in the
Object's finalize method as follows.
  protected void finalize() throws Throwable{
System.out.print(Closing  + connection + ...);
connection.close();
System.out.println(connection);
  }

When executed the method prints somthing like
Closing org.gjt.mm.mysql.jdbc2.Connection@60bf50 ...
org.gjt.mm.mysql.jdbc2.Connection@60bf50


I should also mention that even though an Object's method may share a
Connection, the Object's static methods create and close thier own
Connections.  This means that two connections may be checked out of the
pool.  An archive message said this could mess up the pool, but I have a
hard time beleiving this (what if two separate Objects both need 

Re: Connection pool examples

2002-09-02 Thread Rosdi bin Kasim

Search the archives..
I posted a guide/example regarding this not so long ago.
Try to search for keywords like, datasource, JNDI, Oracle, connection pool,
etc...


- Original Message -
From: Nancy Crisostomo Martinez [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, September 02, 2002 11:13 PM
Subject: Connection pool examples


 Hi everyone!

 I would like to know if there are some practical examples about how to
 implement the Data Base Connection Pool API. (Tomcat, Oracle)
 Could you please give me some references?

 Thanks in advance
 Nancy.


 --
 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]




Re: Connection pool examples

2002-09-02 Thread Nancy Crisostomo Martinez

One more question about this:
Is it possible to implement a pool connection using Jakarta commons in Tomcat
3.3 or do I have to upgrade to 4.x?
This is because I found a couple of examples but they are implemented in Tomcat
4.x.

If I have to upgrade, which version do you recomend me?

Thanks,
Nancy.


Rosdi bin Kasim wrote:

 Search the archives..
 I posted a guide/example regarding this not so long ago.
 Try to search for keywords like, datasource, JNDI, Oracle, connection pool,
 etc...

 - Original Message -
 From: Nancy Crisostomo Martinez [EMAIL PROTECTED]
 To: Tomcat Users List [EMAIL PROTECTED]
 Sent: Monday, September 02, 2002 11:13 PM
 Subject: Connection pool examples

  Hi everyone!
 
  I would like to know if there are some practical examples about how to
  implement the Data Base Connection Pool API. (Tomcat, Oracle)
  Could you please give me some references?
 
  Thanks in advance
  Nancy.
 
 
  --
  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]




Re: Connection Pool Configuration OT!!

2002-05-23 Thread Fabio Mengue

Hi,

D Watson wrote:

 BTW, which version of WS are you using?

WebSphere 4.0 on a Sun Enterprise, with Solaris 8.

Fabio.

--
Fabio Mengue - Centro de Computacao - Unicamp
[EMAIL PROTECTED]   [EMAIL PROTECTED]
Quem se mata de trabalhar merece mesmo morrer. - Millor




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




Re: Connection Pool Configuration

2002-05-21 Thread Fabio Mengue

Hi,

I have the same problem. Want connection pool to work on Tomcat and Websphere
without to rewrite code. IBM send us instructions to set up the server and a
piece of code that looks like this:

...
java.util.Properties parms = new java.util.Properties();
parms.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
com.ibm.websphere.naming.WsnInitialContextFactory);
javax.naming.Context ctx = new
javax.naming.InitialContext(parms);
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup(jdbc/db2proddb02DS);
java.sql.Connection c = ds.getConnection(user,pass);
...

It works on Websphere, but as you can see, initial conext is provided by
Websphere code, and I won't use that in Tomcat (in fact I think this is EJB
code, and Tomcat does not support it; I can't use it even if I want to).

So I'm trying an alternate path:

...
javax.naming.Context ctx = new javax.naming.InitialContext();
javax.sql.DataSource ds =
(javax.sql.DataSource)ctx.lookup(java:comp/env/jdbc/db2proddb02DS);
java.sql.Connection c = ds.getConnection(user,pass);
...

And on /conf/server.xml

!--  MyApp Context --
Context path=/myapp docBase=myapp debug=0
 reloadable=true crossContext=true

  !-- Pool de Conexao DB2 --
  Resource name=jdbc/db2proddb02DS auth=SERVLET
type=javax.sql.DataSource/
ResourceParams name=jdbc/db2proddb02DS
 parameternameuser/namevalue/value/parameter
 parameternamepassword/namevalue/value/parameter
 parameternamedriverClassName/name

valueCOM.ibm.db2.jdbc.DB2ConnectionPoolDataSource/value/parameter
 parameternamedriverName/name
  valuejdbc:db2:database/value/parameter
/ResourceParams
/Context

I'm still getting a Null Pointer error, but I think that when I got it to
work, I might use the very same configuration (and code) on both servers, since
COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource it's not Websphere code.

Hope it helps. And note that I may be wrong :) Perhaps one of the fine people in
this list may correct me.

Fabio.

D Watson wrote:

 I am testing under Tomcat but I will be deploying the project to WebSphere
 (as per the client's request). I would like to be able to have the project
 work under any application server, so I do not want to rely on a 3rd party
 product for pooling but rather use a built in solution (if available).  In
 doing this I also hope to keep any application server specific
 coding/configuration to a minimum.

--
Fabio Mengue - Centro de Computacao - Unicamp
[EMAIL PROTECTED]   [EMAIL PROTECTED]
Quem se mata de trabalhar merece mesmo morrer. - Millor




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




Re: Connection Pool Configuration OT!!

2002-05-21 Thread D Watson

Hello

Thanks for the info Fabio!  I will be using WebSphere version 4 and it has a
connection pool setup in the server admin pages.  I have yet to test my code
under but I have set it up (db conn pool) and it seems quit easy. I should
be able to use my data access code (which is pretty much the same as your
example).  BTW, which version of WS are you using?

Thanks and sorry for being OT!!

D Watson

- Original Message -
From: Fabio Mengue [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Tuesday, May 21, 2002 8:23 AM
Subject: Re: Connection Pool Configuration


 Hi,

 I have the same problem. Want connection pool to work on Tomcat and
Websphere
 without to rewrite code. IBM send us instructions to set up the server and
a
 piece of code that looks like this:

 ...
 java.util.Properties parms = new java.util.Properties();

parms.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY,
 com.ibm.websphere.naming.WsnInitialContextFactory);
 javax.naming.Context ctx = new
 javax.naming.InitialContext(parms);
 javax.sql.DataSource ds =
 (javax.sql.DataSource)ctx.lookup(jdbc/db2proddb02DS);
 java.sql.Connection c = ds.getConnection(user,pass);
 ...

 It works on Websphere, but as you can see, initial conext is provided by
 Websphere code, and I won't use that in Tomcat (in fact I think this is
EJB
 code, and Tomcat does not support it; I can't use it even if I want to).

 So I'm trying an alternate path:

 ...
 javax.naming.Context ctx = new javax.naming.InitialContext();
 javax.sql.DataSource ds =
 (javax.sql.DataSource)ctx.lookup(java:comp/env/jdbc/db2proddb02DS);
 java.sql.Connection c = ds.getConnection(user,pass);
 ...

 And on /conf/server.xml

 !--  MyApp Context --
 Context path=/myapp docBase=myapp debug=0
  reloadable=true crossContext=true

   !-- Pool de Conexao DB2 --
   Resource name=jdbc/db2proddb02DS auth=SERVLET
 type=javax.sql.DataSource/
 ResourceParams name=jdbc/db2proddb02DS
  parameternameuser/namevalue/value/parameter
  parameternamepassword/namevalue/value/parameter
  parameternamedriverClassName/name

 valueCOM.ibm.db2.jdbc.DB2ConnectionPoolDataSource/value/parameter
  parameternamedriverName/name
   valuejdbc:db2:database/value/parameter
 /ResourceParams
 /Context

 I'm still getting a Null Pointer error, but I think that when I got it
to
 work, I might use the very same configuration (and code) on both servers,
since
 COM.ibm.db2.jdbc.DB2ConnectionPoolDataSource it's not Websphere code.

 Hope it helps. And note that I may be wrong :) Perhaps one of the fine
people in
 this list may correct me.

 Fabio.


 --
 Fabio Mengue - Centro de Computacao - Unicamp
 [EMAIL PROTECTED]   [EMAIL PROTECTED]
 Quem se mata de trabalhar merece mesmo morrer. - Millor



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




RE: Connection Pool Configuration

2002-05-20 Thread Mike Jackson

Look at poolman, there's really not a need to re-invent the wheel...

--mikej
-=-
mike jackson
[EMAIL PROTECTED] 

 -Original Message-
 From: D Watson [mailto:[EMAIL PROTECTED]]
 Sent: Saturday, May 18, 2002 8:58 AM
 To: Tomcat Users List
 Subject: Connection Pool Configuration
 
 
 Hello All
 
 I have been trying to implement connection pooling for some time now.  I
 have read the documentation as well as umpteen messages on the 
 list dealing
 with this subject. I have been unable to get it to work and I am not sure
 what I am missing. Could someone please post an example 
 configuration (with
 an explanation of each line) or point me to some kind of newbie-ish
 walk-through?  I am using DB2 under RH Linux 7.1 and Tomcat4.0 on W2K and
 want to connect to the datasource using JNDI.
 
 Thanks!!
 
 D Watson
 
 
 --
 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]




Re: Re: Connection Pool Configuration

2002-05-20 Thread D Watson

I am testing under Tomcat but I will be deploying the project to WebSphere
(as per the client's request). I would like to be able to have the project
work under any application server, so I do not want to rely on a 3rd party
product for pooling but rather use a built in solution (if available).  In
doing this I also hope to keep any application server specific
coding/configuration to a minimum.

- Original Message -
From: Mike Jackson [EMAIL PROTECTED]
To: Tomcat Users List [EMAIL PROTECTED]
Sent: Monday, May 20, 2002 12:40 PM
Subject: RE: Connection Pool Configuration


 Look at poolman, there's really not a need to re-invent the wheel...

 --mikej
 -=-
 mike jackson
 [EMAIL PROTECTED]

  -Original Message-
  From: D Watson [mailto:[EMAIL PROTECTED]]
  Sent: Saturday, May 18, 2002 8:58 AM
  To: Tomcat Users List
  Subject: Connection Pool Configuration
 
 
  Hello All
 
  I have been trying to implement connection pooling for some time now.  I
  have read the documentation as well as umpteen messages on the
  list dealing
  with this subject. I have been unable to get it to work and I am not
sure
  what I am missing. Could someone please post an example
  configuration (with
  an explanation of each line) or point me to some kind of newbie-ish
  walk-through?  I am using DB2 under RH Linux 7.1 and Tomcat4.0 on W2K
and
  want to connect to the datasource using JNDI.
 
  Thanks!!
 
  D Watson
 
 
  --
  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]




Re: connection pool

2000-11-30 Thread Craig R. McClanahan



Landaluze Produktions IS - Carlos wrote:

 in the tomcat conf file (server.xmlk) i have see that there is a conection
 pool for oracle and mysql

This is not actually a connection pool.  It is configuring which JDBC driver
will be used by the JDBCRealm module to look up users for container-managed
security.  You can certainly use SQLServer for this as long as you have a JDBC
driver that supports it -- the details for how to configure the parameters for
this driver should be in the driver's documentation.

The basic entry in server.xml would look similar to the others -- you would
replace the class name with the class name of the driver you want to use, modify
the username and password parameters, and then set up the connection url however
the driver's documentation tells you to.


 1.- is posible to make a conecion pool to a MSQL server?
 2.- if a am using a JDBC driver (rmijdbc) and the SQLserver ip is
 192.168.1.3, how can i make a conection pool to this database?
 i dont known how can i do it?
 please help me
 Thaks
 Carlos

Craig McClanahan