Re: DBCP datasource works on 5.0.28 but fails on 5.5.
This issue was originally submitted by Steve Kirk on 20-May-2005 and RESOLVED on 22-May. FYI, I experienced the same error(s) as Steve and tried all the same things Steve did before discovering Steve's question (and thread) on the User List. The fix (as first advised by Lutz Nicola) was to create the configuration files with the proper settings. I'm running: Apache 2.0.54 (w/the latest mod_jk) TC 5.5.9 (w/multiple instances) mySQL Server 4.1 Win2K Pro (w/multiple IP addresses) The thread was very helpful. I solved my problem after QUADRUPLE CHECKING my web.xml and context.xml files. I don't know what exactly fixed it, but this is what I did (and currently have): WEB.XML 1) Remove the resource-ref related to my database connection CONTEXT.XML 1) Use the improved Resource element style. That is, define as many params as possible within the Resouce Tag: Resource name=jdbc/mysqlTestDb auth=Container type=javax.sql.DataSource/ 2) Define additional non/essential parameters within the ResourceParams Tag: ResourceParams name=jdbc/mysqlTestDb parameter namefactory/name valueorg.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter parameter nametimeBetweenEvictionRunsMillis/name value1/value /parameter parameter nameminEvictableIdleTimeMillis/name value6/value /parameter /ResourceParams 3) Note possible incorrect documentation Note I am using org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory. According to the TC docs, the factory setting should be: org.apache.commons.dbcp.BasicDataSourceFactory There was another thread on this userlist (I can't locate it now) which advised using a different class. All I can say is that when I extract the class list from /Tomcat/common/lib/naming-factory-dbcp.jar, I do *not* see org.apache.commons.dbcp.BasicDataSourceFactory. - Now my SQL statement (w/TagLib) works just fine: ... c:catch var=err1 sql:update sql=INSERT INTO mytable VALUES (?) dataSource=jdbc/mysqlTestDb var=ok sql:param value=${p1}/ /sql:update /c:catch - Ken H.
RE: DBCP datasource works on 5.0.28 but fails on 5.5.
Please stop sending this stuff to me. Somehow, by mistake, I got on this mailing list and don't know a thing about it. WARREN TAYLOR Sunbelt Business Advisors Sunbelt Business Brokers of MS www.sunbeltnetwork.com -Original Message- From: Kenneth B. Harwood [mailto:[EMAIL PROTECTED] Sent: Thursday, July 21, 2005 3:53 PM To: Tomcat Users List Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5. This issue was originally submitted by Steve Kirk on 20-May-2005 and RESOLVED on 22-May. FYI, I experienced the same error(s) as Steve and tried all the same things Steve did before discovering Steve's question (and thread) on the User List. The fix (as first advised by Lutz Nicola) was to create the configuration files with the proper settings. I'm running: Apache 2.0.54 (w/the latest mod_jk) TC 5.5.9 (w/multiple instances) mySQL Server 4.1 Win2K Pro (w/multiple IP addresses) The thread was very helpful. I solved my problem after QUADRUPLE CHECKING my web.xml and context.xml files. I don't know what exactly fixed it, but this is what I did (and currently have): WEB.XML 1) Remove the resource-ref related to my database connection CONTEXT.XML 1) Use the improved Resource element style. That is, define as many params as possible within the Resouce Tag: Resource name=jdbc/mysqlTestDb auth=Container type=javax.sql.DataSource/ 2) Define additional non/essential parameters within the ResourceParams Tag: ResourceParams name=jdbc/mysqlTestDb parameter namefactory/name valueorg.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter parameter nametimeBetweenEvictionRunsMillis/name value1/value /parameter parameter nameminEvictableIdleTimeMillis/name value6/value /parameter /ResourceParams 3) Note possible incorrect documentation Note I am using org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory. According to the TC docs, the factory setting should be: org.apache.commons.dbcp.BasicDataSourceFactory There was another thread on this userlist (I can't locate it now) which advised using a different class. All I can say is that when I extract the class list from /Tomcat/common/lib/naming-factory-dbcp.jar, I do *not* see org.apache.commons.dbcp.BasicDataSourceFactory. - Now my SQL statement (w/TagLib) works just fine: ... c:catch var=err1 sql:update sql=INSERT INTO mytable VALUES (?) dataSource=jdbc/mysqlTestDb var=ok sql:param value=${p1}/ /sql:update /c:catch - Ken H. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
Hi Steve, Am Montag, 23. Mai 2005 00:39 schrieb Steve Kirk: I started replying to yr post including my full config, had nearly finished, then saw the problem - I had a leading space in the 'url' value within the Resource tag of my context.xml file. Grrr! I [...] Thanks very much to both of you for your patient help. Without your prompting, I was ready to start first thing Monday by writing off 3 days' upgrade effort by rolling back to 5.0.28, but now tomorrow is now looking like being productive :) Great. :-) So, your new favourite song is I like Mondays!. ;-) It would have been annoying to downgrade back, having lost all the time and knowing that you have to upgrade sometime again nevertheless. Typing errors are the worst errors to find as everything seems to be right, but what is thought to be right doesn't work. So you can now finally have joy. :-))) Best wishes Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP
DBCP has some config params in the context.xml that will clean up for you if you don't return resources to the pool. It will also test connections for you to make sure they're alive, and close/replace them if not. To config these features, set the params in your Context's DBCP Resource tag, for example: Resource name=jdbc/myDbResource auth=Container type=javax.sql.DataSource maxActive=10 maxIdle=5 maxWait=1 username=ao password=ao driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/myWebApp removeAbandoned=true removeAbandonedTimeout=60 logAbandoned=true validationQuery=select 1 testOnBorrow=true testWhileIdle=true timeBetweenEvictionRunsMillis=1 minEvictableIdleTimeMillis=6 / The attributes in question are those from removeAbandoned down. However it is not advised to rely on this as a means of managing your pool - this is your safety net. It's far better to return connections to the pool yourself in the first place. A proper try/catch/finally structure is the way to go, there are numerous examples on the web. You don't mention your TC version but a good starting poing in the docs for the latest version (5.5.x) are here: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-how to.html Read the whole page, and for a decent try/catch/finally code example, focus on the code in the section Random Connection Closed Exceptions. -Original Message- From: Charles P. Killmer [mailto:[EMAIL PROTECTED] Sent: Monday 23 May 2005 17:43 To: Tomcat Users List Subject: DBCP Supposing I forgot to close a database connection. And the script was requested numerous times. And now my scripts can not get any database connections. Is there a way to close those connections without restarting Tomcat? Charles - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP datasource works on 5.0.28 but fails on 5.5.9
Thanks again Nix, but latest mysql driver is *definitely* in %catalina_home%\common\lib : C:\dir %catalina_home%\common\lib Volume in drive C is BOOT Volume Serial Number is D4DF-165E Directory of c:\jakarta-tomcat-5.5.9\common\lib 19/05/2005 19:25DIR . 19/05/2005 19:25DIR .. 11/05/2004 12:5454,829 activation.jar 26/03/2005 14:22 112,341 commons-el.jar 26/03/2005 14:22 918,743 jasper-compiler-jdt.jar 26/03/2005 14:22 383,134 jasper-compiler.jar 26/03/2005 14:2276,664 jasper-runtime.jar 26/03/2005 14:2250,493 jsp-api.jar 12/10/2004 13:20 347,137 mail.jar 14/04/2005 22:44 409,191 mysql-connector-java-3.1.8-bin.jar 26/03/2005 14:22 154,101 naming-factory-dbcp.jar 26/03/2005 14:2236,333 naming-factory.jar 26/03/2005 14:2246,606 naming-resources.jar 26/03/2005 14:2297,693 servlet-api.jar 12 File(s) 2,687,265 bytes 2 Dir(s) 2,182,369,280 bytes free OK, so now I'm struggling. So I'm going to take a punt and say that I think there may be some kind of class loading problem. I say this because: - I have fresh installed TC, mysql and jdk; - mysql works from the command line using my datasource username/pw; - I have checked and rechecked my config a thousand times; - the mysql driver is in the right folder; - the error is suggestive of the fact that TC can't find the driver. However, the driver it is there in the common/lib folder, plain for anyone to see. I can only assume this is to do with security/classloading. I've eliminated security, because TC runs as a service under the system account, and I've checked that this account has read access to the file. I'm almost tired of looking - if I can't solve it tomorrow, I'll be (very reluctantly) setting aside TC 5.5 and carrying on with 5.0.28. I don't want to do that, because 5.0.28 has some sesssion management bugs I'd like to get past, and also because I've now spent 3 days trying to make 5.5 work. So, any help would be most gratefully received :) Original post here for those that missed it: http://marc.theaimsgroup.com/?l=tomcat-userm=111660199623420w=2 -Original Message- From: Nikola Milutinovic [mailto:[EMAIL PROTECTED] Sent: Saturday 21 May 2005 13:42 To: Tomcat Users List Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9 Steve Kirk wrote: Thanks nix. Could it be that you've missed the fact that DataSource JNDI resource setup definition has changed in TC 5.5? It is no longer with those parametername.../namevalue.../value/parameter. Yes I already changed that. I used to use the approach you mention in 5.0.28, i.e.: ResourceParams name=jdbc/myResource parameter nameusername/name value.../value /parameter parameter namepassword/name value.../value /parameter etc /ResourceParams But noticed that the new 5.5 DBCP example used this approach: Resource username= password=... etc / So I switched to that, but still no joy. PS does it actually say in the docs anywhere that the parametername.../namevalue.../value/parameter approach is *NOT* valid in 5.5? If so then I've missed some docs somewhere, maybe there is other new stuff that I haven't seen. It definitely does not work in 5.5. I've used the config from the docs page with PostgreSQL and it worked. Other possible problem is that the driver class didn't load. Where have you placed the JDBC JAR? It goes either in ${CATALINA_HOME}/common/lib since it must be accessable to TC. Nix. - 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: DBCP datasource works on 5.0.28 but fails on 5.5.9
Hi Steve, Am Sonntag, 22. Mai 2005 22:58 schrieb Steve Kirk: Thanks again Nix, but latest mysql driver is *definitely* in %catalina_home%\common\lib : Did you check that the MySQL driver is only there and not additionally in a second directory, i.e. WEB-INF/lib, which could confuse Tomcat? - mysql works from the command line using my datasource username/pw; Are you really using the correct URL to connect to the database? Are host name, port and database name ok? I.e. the database name is case-sensitive (at least on Linux, check it on Windows)! Are you running Tomcat with Security Manager? Then you may have missed to set the necessary security rules for connecting. I'm almost tired of looking - if I can't solve it tomorrow, I'll be (very reluctantly) setting aside TC 5.5 and carrying on with 5.0.28. I don't want to do that, because 5.0.28 has some sesssion management bugs I'd like to get past, and also because I've now spent 3 days trying to make 5.5 work. Perhaps you can post your exact configuration here, anonymizing user and password values. What did you configure where? I.e. where is the context file in which you did the relevant entry? Etc. Bet wishes Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP datasource works on 5.0.28 but fails on 5.5.9
Lutz, I started replying to yr post including my full config, had nearly finished, then saw the problem - I had a leading space in the 'url' value within the Resource tag of my context.xml file. Grrr! I must have included it by accident when converting from the nested ResourceParamsparameter/parameter/ResourceParams approach used in TC5.0 to the single Resource/ tag approach favoured in TC5.5. So basically Nix was right in his first post... Thanks very much to both of you for your patient help. Without your prompting, I was ready to start first thing Monday by writing off 3 days' upgrade effort by rolling back to 5.0.28, but now tomorrow is now looking like being productive :) -Original Message- From: Lutz Zetzsche [mailto:[EMAIL PROTECTED] Sent: Sunday 22 May 2005 22:42 To: Tomcat Users List Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9 Hi Steve, Am Sonntag, 22. Mai 2005 22:58 schrieb Steve Kirk: Thanks again Nix, but latest mysql driver is *definitely* in %catalina_home%\common\lib : Did you check that the MySQL driver is only there and not additionally in a second directory, i.e. WEB-INF/lib, which could confuse Tomcat? - mysql works from the command line using my datasource username/pw; Are you really using the correct URL to connect to the database? Are host name, port and database name ok? I.e. the database name is case-sensitive (at least on Linux, check it on Windows)! Are you running Tomcat with Security Manager? Then you may have missed to set the necessary security rules for connecting. I'm almost tired of looking - if I can't solve it tomorrow, I'll be (very reluctantly) setting aside TC 5.5 and carrying on with 5.0.28. I don't want to do that, because 5.0.28 has some sesssion management bugs I'd like to get past, and also because I've now spent 3 days trying to make 5.5 work. Perhaps you can post your exact configuration here, anonymizing user and password values. What did you configure where? I.e. where is the context file in which you did the relevant entry? Etc. Bet wishes Lutz - 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: DBCP datasource works on 5.0.28 but fails on 5.5.9
Steve Kirk wrote: Thanks nix. Could it be that you've missed the fact that DataSource JNDI resource setup definition has changed in TC 5.5? It is no longer with those parametername.../namevalue.../value/parameter. Yes I already changed that. I used to use the approach you mention in 5.0.28, i.e.: ResourceParams name=jdbc/myResource parameter nameusername/name value.../value /parameter parameter namepassword/name value.../value /parameter etc /ResourceParams But noticed that the new 5.5 DBCP example used this approach: Resource username= password=... etc / So I switched to that, but still no joy. PS does it actually say in the docs anywhere that the parametername.../namevalue.../value/parameter approach is *NOT* valid in 5.5? If so then I've missed some docs somewhere, maybe there is other new stuff that I haven't seen. It definitely does not work in 5.5. I've used the config from the docs page with PostgreSQL and it worked. Other possible problem is that the driver class didn't load. Where have you placed the JDBC JAR? It goes either in ${CATALINA_HOME}/common/lib since it must be accessable to TC. Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP Exception
Post the parts of your config files that pertain to the database and a code snippet where you are calling out the connection. Looks like a misconfiguration but only a guess until we see the configs. Don't forget to change passwords and user names before posting. Also what OS JVM and Tomcat version are you running? Doug - Original Message - From: Joy Kenneth Harry [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, May 20, 2005 8:40 AM Subject: DBCP Exception Hi, Can you tell why I am getting this exception. SEVERE: Null component Catalina:type=DataSource,path=/,host=localhost,class=javax.sql.DataSourc e, name=jdbc/oracle Thanks Joy Kenneth Harry Infosys Tech Ltd - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
Steve Kirk wrote: When TC starts up, the webapp deploys OK from its war file, and the context.xml is copied to the /conf/[engine]/[host]/ folder OK, without any parsing errors logged. The connection pool initially seems to work, in the sense that this code executes OK: Context ctx = new InitialContext(); String resourceString = java:comp/env/jdbc/ + config.getString(ConfigConstants.JNDI_DATABASE_RESOURCE_NAME); DataSource pool = (DataSource)ctx.lookup(resourceString); However, an Exception is thrown the first time that I do this: Connection conn = pool.getConnection(); This doens't mean much. You will get a DBCP object event if connection data is wrong. It will however fail on attempting to obtain a connection. In my oppinion it would be nice if it failed during web app deployment, thus not leading us to believe all is OK. Although it would be yet another source of frustration. And I can see an argument that failing to correctly setup a DataSource should not invalidate the entire web app, since it could be setup with N DataSources and inteligence to choose one that works. - Exception caught when establishing/testing database pool cause[0]: org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' This most commonly means that the definition of the DataSource resource lacks driver definition. Could it be that you've missed the fact that DataSource JNDI resource setup definition has changed in TC 5.5? It is no longer with those parametername.../namevalue.../value/parameter. Check it out. Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP datasource works on 5.0.28 but fails on 5.5.9
Hi, Am Freitag, 20. Mai 2005 17:22 schrieb Nikola Milutinovic: Steve Kirk wrote: This most commonly means that the definition of the DataSource resource lacks driver definition. Could it be that you've missed the fact that DataSource JNDI resource setup definition has changed in TC 5.5? It is no longer with those parametername.../namevalue.../value/parameter. Check it out. This is exactly what I would guess, too. From Tomcat 5.0 to 5.5, the Resource element syntax has changed. It is now like: Resource name=... auth=Container type=javax.sql.DataSource driverClassName=... url=jdbc:... username=... password=... maxActive=20 maxIdle=10 maxWait=-1 removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true / Best wishes Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP datasource works on 5.0.28 but fails on 5.5.9
Thanks nix. Could it be that you've missed the fact that DataSource JNDI resource setup definition has changed in TC 5.5? It is no longer with those parametername.../namevalue.../value/parameter. Yes I already changed that. I used to use the approach you mention in 5.0.28, i.e.: ResourceParams name=jdbc/myResource parameter nameusername/name value.../value /parameter parameter namepassword/name value.../value /parameter etc /ResourceParams But noticed that the new 5.5 DBCP example used this approach: Resource username= password=... etc / So I switched to that, but still no joy. PS does it actually say in the docs anywhere that the parametername.../namevalue.../value/parameter approach is *NOT* valid in 5.5? If so then I've missed some docs somewhere, maybe there is other new stuff that I haven't seen. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP datasource works on 5.0.28 but fails on 5.5.9
Thanks lutz, that's in fact exactly how I now have it. I have also deleted the webapp (and the context xml file under /conf) and recompiled/restarted, to make sure the new context config is loaded, but still no joy. -Original Message- From: Lutz Zetzsche [mailto:[EMAIL PROTECTED] Sent: Friday 20 May 2005 16:59 To: Tomcat Users List Subject: Re: DBCP datasource works on 5.0.28 but fails on 5.5.9 Hi, Am Freitag, 20. Mai 2005 17:22 schrieb Nikola Milutinovic: Steve Kirk wrote: This most commonly means that the definition of the DataSource resource lacks driver definition. Could it be that you've missed the fact that DataSource JNDI resource setup definition has changed in TC 5.5? It is no longer with those parametername.../namevalue.../value/parameter. Check it out. This is exactly what I would guess, too. From Tomcat 5.0 to 5.5, the Resource element syntax has changed. It is now like: Resource name=... auth=Container type=javax.sql.DataSource driverClassName=... url=jdbc:... username=... password=... maxActive=20 maxIdle=10 maxWait=-1 removeAbandoned=true removeAbandonedTimeout=300 logAbandoned=true / Best wishes Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP ClassCastException
Dhiren Bhatia wrote: I'm using BasicDataSource because javax.sql.DataSource does not have methods to set the driver class name, url, username/pwd etc. My app needs to support different databases and the driver is loaded based on which database is installed. You've got it backwards. It is the responsibility of a J2EE container to use whatever the implementatio it likes and set those parameters and then give your application just javax.sql.DataSource. THAT will make your application portable. Nix. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP ClassCastException
Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref *server.xml* ** ResourceParams name=jdbc/myserver parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter *...* This same code works in Tomcat 5.0.30. Has anything changed? Am I missing something? Yes. The syntax for the Resource tag in the server.xml has changed. The resource parameters are no longer defined in tags nested into the Resource tag, but in attributes of the tag. This is an example from the Tomcat 5.5 documentation: Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html Best wishes, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP ClassCastException
Hi Lutz, I changed the Resource tag definition to: Resource name=jdbc/myserver auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 driverClassName=com.mysql.jdbc.Driver/ I'm setting the username/password and jdbcurl using code. I still get the same ClassCastException. Is Tomcat instantiating the correct DataSourceFactory? I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib Thanks, Dhiren On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref *server.xml* ** ResourceParams name=jdbc/myserver parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter *...* This same code works in Tomcat 5.0.30. Has anything changed? Am I missing something? Yes. The syntax for the Resource tag in the server.xml has changed. The resource parameters are no longer defined in tags nested into the Resource tag, but in attributes of the tag. This is an example from the Tomcat 5.5 documentation: Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html Best wishes, Lutz - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP ClassCastException
I'm using BasicDataSource because javax.sql.DataSource does not have methods to set the driver class name, url, username/pwd etc. My app needs to support different databases and the driver is loaded based on which database is installed. If I use org.apache.tomcat.dbcp.dbcp.BasicDataSource, then my code is not portable to JBoss/Weblogic etc right? BTW, which jar is org.apache.tomcat.dbcp.dbcp.BasicDataSource in? Thanks for your response. Dhiren On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the source and put it in other packages. So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of org.apache.commons.dbcp.BasicDataSource in your source - btw why do you cast to BasicDataSource, you can use javax.sql.DataSource? Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 17:19 An: Tomcat Users List Betreff: Re: DBCP ClassCastException Hi Lutz, I changed the Resource tag definition to: Resource name=jdbc/myserver auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 driverClassName=com.mysql.jdbc.Driver/ I'm setting the username/password and jdbcurl using code. I still get the same ClassCastException. Is Tomcat instantiating the correct DataSourceFactory? I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib Thanks, Dhiren On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref *server.xml* ** ResourceParams name=jdbc/myserver parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter *...* This same code works in Tomcat 5.0.30. Has anything changed? Am I missing something? Yes. The syntax for the Resource tag in the server.xml has changed. The resource parameters are no longer defined in tags nested into the Resource tag, but in attributes of the tag. This is an example from the Tomcat 5.5 documentation: Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html Best wishes, Lutz - 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: DBCP ClassCastException
It works if I use org.apache.tomcat.dbcp.dbcp.BasicDataSource. I've tried adding all the commons jars to common/lib and it still doesn't work with org.apache.commons.dbcp.BasicDataSource. How do you get it to cast with your own resource factory? The way I see it, it should be the same thing if you're extending from org.apache.commons.dbcp.BasicDataSource. Just FYI...Here's what I have in commons/lib: commons-collections-3.1.jar* log4j.jar* commons-dbcp-1.2.1.jar* mysql-connector-java-3.1.7-bin.jar* commons-pool-1.2.jar* naming-factory-dbcp.jar* jasper-compiler-jdt.jar* naming-factory.jar* jasper-compiler.jar* naming-resources.jar* jasper-runtime.jar* servlet-api.jar* jsp-api.jar* On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: You can find org.apache.tomcat.dbcp.dbcp.BasicDataSource in common/lib/naming-factory-dbcp.jar. If you put commons-dbcp.jar, commons-pool.jar and commons-collections.jarin common/lib you (maybe) should be able to use org.apache.commons.dbcp.BasicDataSource. I do it in a similar way - I have my own ressource factory, which extends org.apache.commons.dbcp.BasicDataSourceFactory and it works in tomcat 5.5with the above jars. Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 18:47 An: Tomcat Users List Betreff: Re: DBCP ClassCastException I'm using BasicDataSource because javax.sql.DataSource does not have methods to set the driver class name, url, username/pwd etc. My app needs to support different databases and the driver is loaded based on which database is installed. If I use org.apache.tomcat.dbcp.dbcp.BasicDataSource, then my code is not portable to JBoss/Weblogic etc right? BTW, which jar is org.apache.tomcat.dbcp.dbcp.BasicDataSource in? Thanks for your response. Dhiren On 5/9/05, Pfingstl Gernot [EMAIL PROTECTED] wrote: Tomcat 5.5 doesn't use commons-dbcp directly, the tomcat team took the source and put it in other packages. So you should use org.apache.tomcat.dbcp.dbcp.BasicDataSource instead of org.apache.commons.dbcp.BasicDataSource in your source - btw why do you cast to BasicDataSource, you can use javax.sql.DataSource? Gernot -Ursprüngliche Nachricht- Von: Dhiren Bhatia [mailto:[EMAIL PROTECTED] Gesendet: Montag, 09. Mai 2005 17:19 An: Tomcat Users List Betreff: Re: DBCP ClassCastException Hi Lutz, I changed the Resource tag definition to: Resource name=jdbc/myserver auth=Container type= javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 driverClassName=com.mysql.jdbc.Driver/ I'm setting the username/password and jdbcurl using code. I still get the same ClassCastException. Is Tomcat instantiating the correct DataSourceFactory? I have the commons-dbcp-1.2.1.jar in my ${TOMCAT_HOME}/common/lib Thanks, Dhiren On 5/8/05, Lutz Zetzsche [EMAIL PROTECTED] wrote: Hi Dhiren, Am Montag, 9. Mai 2005 07:36 schrieb Dhiren Bhatia: Hi all, I'm getting a the following ClassCastException running Tomcat 5.5.9 with MySQL java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp.BasicDataSource Here's the relevant code: *Java code:* org.apache.commons.dbcp.BasicDataSource datasource; datasource = (BasicDataSource)ctx.lookup(java:comp/env/jdbc/myserver); *web.xml* resource-ref descriptionDB Connection/description res-ref-namejdbc/myserver/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref *server.xml* ** ResourceParams name=jdbc/myserver parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter *...* This same code works in Tomcat 5.0.30. Has anything changed? Am I missing something? Yes. The syntax for the Resource tag in the server.xml has changed. The resource parameters are no longer defined in tags nested into the Resource tag, but in attributes of the tag. This is an example from the Tomcat 5.5 documentation: Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/javatest?autoReconnect=true/ http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html Best wishes, Lutz - 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
Re: DBCP monitoring tool
I usually do this at the database level. I can give you an example of the SQL that we run to see how many connections as well as cursors are being used by our Thin JDBC clients to Oracle: To get sessions/connections to oracle: select sid,username,program from v$session where program = 'JDBC Thin Client'; To get cursors information: select b.name,a.* from v$sesstat a,v$statname b where a.statistic# = b.statistic# and b.name in ('opened cursors current','opened cursors cumulative', 'session uga memory','session pga memory') and a.sid in (select sid from v$session where program = 'JDBC Thin Client') order by b.name; To get open cursors: select * from v$open_cursor where sid in (select sid from v$session where program = 'JDBC Thin Client'); Regards, Jimmy Ray --- Gabriel Belingueres [EMAIL PROTECTED] wrote: Hi, Are there any DBCP monitoring tool that allow me to monitor how many open connections (and other stats) does DBCP holding? TIA, Gabriel Yahoo! Mail Stay connected, organized, and protected. Take the tour: http://tour.mail.yahoo.com/mailtour.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP monitoring tool
On 5/9/05, Gabriel Belingueres [EMAIL PROTECTED] wrote: Hi, Are there any DBCP monitoring tool that allow me to monitor how many open connections (and other stats) does DBCP holding? With Tomcat 5.5.4+, DBCP datasources should have an associated MBean, with all the useful statistics. -- x Rémy Maucherat Developer Consultant JBoss Group (Europe) SàRL x - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Antwort: Re: DBCP/JDBC Problems with DelegatingResultSet
[EMAIL PROTECTED] .com An Tomcat Users List 12.04.2005 17:26 tomcat-user@jakarta.apache.org Kopie Bitte antwortenThema an Re: DBCP/JDBC Problems with Tomcat UsersDelegatingResultSet List [EMAIL PROTECTED] rta.apache.org Do you mean that perhaps you are trying to access SYBASE specific JDBC extensions? If so, then you need the inner most delegate connection. I did this with Oracle: I also had this parameter in my JNDI declaration in the server.xml... parameter nameaccessToUnderlyingConnectionAllowed/name valuetrue/value /parameter Then I used this static method that I wrote. Just pass in the JNDI data source name. BUT...be careful, DO NOT close this underlying connection, or your next call will have the overhead of recreating the underlying connection object for DBCP: public static synchronized Connection getDelegatingConnection( String dataSource) throws SQLException,NamingException,Exception { final String JNDI_LOOKUP = java:comp/env; Connection conn = null; OracleConnection oc = null; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(JNDI_LOOKUP); if (envCtx == null) { throw new Exception(No EnvironmentContextException); } DataSource ds = (DataSource) envCtx.lookup(dataSource); if (ds == null) { throw new Exception(No DatasourceException); } ((BasicDataSource) ds).setAccessToUnderlyingConnectionAllowed(true); conn = ds.getConnection(); if (conn == null) { throw new Exception(No ConnectionException); } Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate(); if (dconn == null) { throw new Exception(No DelegatingConnectionException); } conn.close(); conn=null; return dconn; } Regards, Jimmy Ray --- [EMAIL PROTECTED] wrote: Hello, I need some help accessing low level routines using JDNI based connection pooling provided by tomcat. Environment: J2SE 1.4.2 Tomcat: 5.5 JDBC-Driver: Sybase JConnect 5.5 (TDS) The Tomcat is configured to provide a small connection pool. Within my servlet i need access to the low-level implementation of the ResultSet from Sybase. The problem is, that the following code: Connection conn = dataSource.getConnection(); Statement stmt = conn.getConnection(); ResultSet result = stmt.executeQuery( ... ); System.out.println( result.getClass().getName() ); prints org.apache.tomcat.dbcp.dbcp.DelegatingResultSet. I couldn't find a api documentation for this class nor could i find the jar file providing this class at all in the tomcat installation directory. Can anyone give a hint in which JAR archive this class can be found ? Mit freundlichen Grüßen / Kind regards Sebastian Wiemer Sebastian Wiemer GfK Group Data Services GmbH Nordwestring 101 D-90319 Nürnberg Fon: +49 (0) 911 395 3876 Fax: +49 (0) 911 333 796 [EMAIL PROTECTED] www.gfk.de / www.gfk.com _ Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail (and any attachment/s) contains confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED
Re: DBCP/JDBC Problems with DelegatingResultSet
Do you mean that perhaps you are trying to access SYBASE specific JDBC extensions? If so, then you need the inner most delegate connection. I did this with Oracle: I also had this parameter in my JNDI declaration in the server.xml... parameter nameaccessToUnderlyingConnectionAllowed/name valuetrue/value /parameter Then I used this static method that I wrote. Just pass in the JNDI data source name. BUT...be careful, DO NOT close this underlying connection, or your next call will have the overhead of recreating the underlying connection object for DBCP: public static synchronized Connection getDelegatingConnection( String dataSource) throws SQLException,NamingException,Exception { final String JNDI_LOOKUP = java:comp/env; Connection conn = null; OracleConnection oc = null; Context initCtx = new InitialContext(); Context envCtx = (Context) initCtx.lookup(JNDI_LOOKUP); if (envCtx == null) { throw new Exception(No EnvironmentContextException); } DataSource ds = (DataSource) envCtx.lookup(dataSource); if (ds == null) { throw new Exception(No DatasourceException); } ((BasicDataSource) ds).setAccessToUnderlyingConnectionAllowed(true); conn = ds.getConnection(); if (conn == null) { throw new Exception(No ConnectionException); } Connection dconn = ((DelegatingConnection) conn).getInnermostDelegate(); if (dconn == null) { throw new Exception(No DelegatingConnectionException); } conn.close(); conn=null; return dconn; } Regards, Jimmy Ray --- [EMAIL PROTECTED] wrote: Hello, I need some help accessing low level routines using JDNI based connection pooling provided by tomcat. Environment: J2SE 1.4.2 Tomcat: 5.5 JDBC-Driver: Sybase JConnect 5.5 (TDS) The Tomcat is configured to provide a small connection pool. Within my servlet i need access to the low-level implementation of the ResultSet from Sybase. The problem is, that the following code: Connection conn = dataSource.getConnection(); Statement stmt = conn.getConnection(); ResultSet result = stmt.executeQuery( ... ); System.out.println( result.getClass().getName() ); prints org.apache.tomcat.dbcp.dbcp.DelegatingResultSet. I couldn't find a api documentation for this class nor could i find the jar file providing this class at all in the tomcat installation directory. Can anyone give a hint in which JAR archive this class can be found ? Mit freundlichen Grüßen / Kind regards Sebastian Wiemer Sebastian Wiemer GfK Group Data Services GmbH Nordwestring 101 D-90319 Nürnberg Fon: +49 (0) 911 395 3876 Fax: +49 (0) 911 333 796 [EMAIL PROTECTED] www.gfk.de / www.gfk.com _ Diese E-Mail (ggf. nebst Anhang) enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind, oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet. This e-mail (and any attachment/s) contains confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Small Business - Try our new resources site! http://smallbusiness.yahoo.com/resources/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP Please Help Get Working Properly
Ok, define 'no results'. In reality, the naming import isn't the only thing that changed. Your web.xml file *looks* like 2.3 spec from what I can see and you are using JSP 2.x spec syntax in your jsp. If you want the JSP 2.x spec features, you need to declare your web.xml file for servlet 2.4 spec. This should be up at the top of your web.xml (pasted from the specification for servlet 2.4): ?xml version=1.0 encoding=ISO-8859-1? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 Then just put all your servlet-mappings, etc., ... after that. The taglib declarations need to be inside a jsp-config element for the 2.4 spec web.xml file too. That's how I'm guessing you have a 2.3 spec web.xml file. The full spec can be found at http://www.jcp.org/en/jsr/detail?id=154 --David Scott Purcell wrote: Hello, I am trying to use the DBCP features of Tomcat 5.5.7. I created a webapp named testDB and put it under $CATALINA_HOME/webapps/testDB. Then I created a testDB.xml file under $CATALINA_HOME/conf/Catalina/localhost/testDB.xml. // here it is Context path=/testDB docBase=testDB debug=5 reloadable=true crossContext=true Resource name=jdbc/testDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fritest?autoReconnect=true/ /Context I have been following the notes from: http://localhost/tomcat-docs/jndi-datasource-examples-howto.html I made sure I completed the rest of the tasks. WEB-INF has the two tag locations, and the resource ref. eg: taglib taglib-uri/WEB-INF/sql.tld/taglib-uri taglib-location/WEB-INF/sql.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib resource-ref descriptionDB Connection/description res-ref-namejdbc/testDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I finally hit my jsp page which is this: %@ taglib uri=http://java.sun.com/jsp/jstl/sql; prefix=sql % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % sql:query var=rs dataSource=jdbc/testDB select id, foo, bar from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} Foo ${row.foo}br/ Bar ${row.bar}br/ /c:forEach /body /html And I get no results: Now I am pretty sure I have all configured. Because if I use a fallback (Tomcat 4.1) code piece I had, I get results using the same settings: package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/testDB); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); while(rst.next()) { System.out.println(next ); foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } And using the above class works all day. The only difference I see is that the class using a naming import and the jsp does not. Can anyone help. Thanks, Scott -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 1:14 PM To: Tomcat Users List Subject: Re: Add Context Path, Tomcat 5.5.7 Hi. Take a look at this for where to put Context elements: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html This is new with Tomcat 5.0 and is continued in Tomcat 5.5 --David Scott Purcell wrote: Hello, I am following the information here to add DBCP to my application. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html I am reading to add the Context path=/DBTest ... from the above docs. The instructions say to . Configure the JNDI DataSource in Tomcat by adding a declaration for your resource to $CATALINA_HOME/conf/server.xml. Add this in between the /Context tag of the examples context and the /Host tag closing the localhost definition. So cool, I opened up the server.xml, but do not see any existing context or host tags in it. Here is my
RE: DBCP Please Help Get Working Properly
Thank David for the below information. This makes some sense, and I will try and make the changes. But this of course leads to a follow-up question. Why isn't there any decent documentation to get the DBCP running in Tomcat. I am talking about a simple example, that explains container versions, jsp versions, possibly better ways to use then putting the connection into a JSP page. Connecting in a JSP page is just plain dirty, I would like to connect in some class where I can call connections from. Does this make sense? As I mentioned, I followed the example that comes with the documentation for my 5.5 Tomcat that displays when you go to localhost. So, is there any good documentation that shows how to do this, step by step? Thanks, Scott -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Monday, April 11, 2005 8:18 AM To: Tomcat Users List Subject: Re: DBCP Please Help Get Working Properly Ok, define 'no results'. In reality, the naming import isn't the only thing that changed. Your web.xml file *looks* like 2.3 spec from what I can see and you are using JSP 2.x spec syntax in your jsp. If you want the JSP 2.x spec features, you need to declare your web.xml file for servlet 2.4 spec. This should be up at the top of your web.xml (pasted from the specification for servlet 2.4): ?xml version=1.0 encoding=ISO-8859-1? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 Then just put all your servlet-mappings, etc., ... after that. The taglib declarations need to be inside a jsp-config element for the 2.4 spec web.xml file too. That's how I'm guessing you have a 2.3 spec web.xml file. The full spec can be found at http://www.jcp.org/en/jsr/detail?id=154 --David Scott Purcell wrote: Hello, I am trying to use the DBCP features of Tomcat 5.5.7. I created a webapp named testDB and put it under $CATALINA_HOME/webapps/testDB. Then I created a testDB.xml file under $CATALINA_HOME/conf/Catalina/localhost/testDB.xml. // here it is Context path=/testDB docBase=testDB debug=5 reloadable=true crossContext=true Resource name=jdbc/testDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fritest?autoReconnect=true/ /Context I have been following the notes from: http://localhost/tomcat-docs/jndi-datasource-examples-howto.html I made sure I completed the rest of the tasks. WEB-INF has the two tag locations, and the resource ref. eg: taglib taglib-uri/WEB-INF/sql.tld/taglib-uri taglib-location/WEB-INF/sql.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib resource-ref descriptionDB Connection/description res-ref-namejdbc/testDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I finally hit my jsp page which is this: %@ taglib uri=http://java.sun.com/jsp/jstl/sql; prefix=sql % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % sql:query var=rs dataSource=jdbc/testDB select id, foo, bar from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} Foo ${row.foo}br/ Bar ${row.bar}br/ /c:forEach /body /html And I get no results: Now I am pretty sure I have all configured. Because if I use a fallback (Tomcat 4.1) code piece I had, I get results using the same settings: package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/testDB); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); while(rst.next()) { System.out.println(next ); foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } And using the above class works all day. The only difference I see is that the class using a naming import
Re: DBCP Please Help Get Working Properly
Well yes it does make a lot of sense, but is more a question answered by design patterns. It's a little beyond the scope of Tomcat docs to address issues like separation of roles. Both Struts and Spring projects address issues like this with the Model-View-Controller (MVC) pattern and there are innumerable books on the subject as well. Specific to data access methods, Hibernate also addresses this issue. As far as step by step docs, you are best off picking a framework, getting a good book on it and go from there. Hope this helps. --David Scott Purcell wrote: Thank David for the below information. This makes some sense, and I will try and make the changes. But this of course leads to a follow-up question. Why isn't there any decent documentation to get the DBCP running in Tomcat. I am talking about a simple example, that explains container versions, jsp versions, possibly better ways to use then putting the connection into a JSP page. Connecting in a JSP page is just plain dirty, I would like to connect in some class where I can call connections from. Does this make sense? As I mentioned, I followed the example that comes with the documentation for my 5.5 Tomcat that displays when you go to localhost. So, is there any good documentation that shows how to do this, step by step? Thanks, Scott -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Monday, April 11, 2005 8:18 AM To: Tomcat Users List Subject: Re: DBCP Please Help Get Working Properly Ok, define 'no results'. In reality, the naming import isn't the only thing that changed. Your web.xml file *looks* like 2.3 spec from what I can see and you are using JSP 2.x spec syntax in your jsp. If you want the JSP 2.x spec features, you need to declare your web.xml file for servlet 2.4 spec. This should be up at the top of your web.xml (pasted from the specification for servlet 2.4): ?xml version=1.0 encoding=ISO-8859-1? web-app xmlns=http://java.sun.com/xml/ns/j2ee; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation=http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd; version=2.4 Then just put all your servlet-mappings, etc., ... after that. The taglib declarations need to be inside a jsp-config element for the 2.4 spec web.xml file too. That's how I'm guessing you have a 2.3 spec web.xml file. The full spec can be found at http://www.jcp.org/en/jsr/detail?id=154 --David Scott Purcell wrote: Hello, I am trying to use the DBCP features of Tomcat 5.5.7. I created a webapp named testDB and put it under $CATALINA_HOME/webapps/testDB. Then I created a testDB.xml file under $CATALINA_HOME/conf/Catalina/localhost/testDB.xml. // here it is Context path=/testDB docBase=testDB debug=5 reloadable=true crossContext=true Resource name=jdbc/testDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fritest?autoReconnect=true/ /Context I have been following the notes from: http://localhost/tomcat-docs/jndi-datasource-examples-howto.html I made sure I completed the rest of the tasks. WEB-INF has the two tag locations, and the resource ref. eg: taglib taglib-uri/WEB-INF/sql.tld/taglib-uri taglib-location/WEB-INF/sql.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib resource-ref descriptionDB Connection/description res-ref-namejdbc/testDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I finally hit my jsp page which is this: %@ taglib uri=http://java.sun.com/jsp/jstl/sql; prefix=sql % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % sql:query var=rs dataSource=jdbc/testDB select id, foo, bar from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} Foo ${row.foo}br/ Bar ${row.bar}br/ /c:forEach /body /html And I get no results: Now I am pretty sure I have all configured. Because if I use a fallback (Tomcat 4.1) code piece I had, I get results using the same settings: package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/testDB); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); while
RE: DBCP Please Help Get Working Properly
Do you have anything in your Tomcat log files that might help? If not, you can bump up the debug levels in server.xml and you might get some more info. I also found that adding one of the two following listeners in my server.xml helped me debug my DBCP problems (I don't remember which one I added, but it should be obvious): Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=9/ Listener className=org.apache.catalina.core.NamingContextListener debug=9/ Jay Vertical Technology Group http://www.vtgroup.com/ -Original Message- From: Scott Purcell [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 3:08 PM To: Tomcat Users List Subject: DBCP Please Help Get Working Properly Hello, I am trying to use the DBCP features of Tomcat 5.5.7. I created a webapp named testDB and put it under $CATALINA_HOME/webapps/testDB. Then I created a testDB.xml file under $CATALINA_HOME/conf/Catalina/localhost/testDB.xml. // here it is Context path=/testDB docBase=testDB debug=5 reloadable=true crossContext=true Resource name=jdbc/testDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fritest?autoReconnect=true/ /Context I have been following the notes from: http://localhost/tomcat-docs/jndi-datasource-examples-howto.html I made sure I completed the rest of the tasks. WEB-INF has the two tag locations, and the resource ref. eg: taglib taglib-uri/WEB-INF/sql.tld/taglib-uri taglib-location/WEB-INF/sql.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib resource-ref descriptionDB Connection/description res-ref-namejdbc/testDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I finally hit my jsp page which is this: %@ taglib uri=http://java.sun.com/jsp/jstl/sql; prefix=sql % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % sql:query var=rs dataSource=jdbc/testDB select id, foo, bar from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} Foo ${row.foo}br/ Bar ${row.bar}br/ /c:forEach /body /html And I get no results: Now I am pretty sure I have all configured. Because if I use a fallback (Tomcat 4.1) code piece I had, I get results using the same settings: package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/testDB); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); while(rst.next()) { System.out.println(next ); foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } And using the above class works all day. The only difference I see is that the class using a naming import and the jsp does not. Can anyone help. Thanks, Scott -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 1:14 PM To: Tomcat Users List Subject: Re: Add Context Path, Tomcat 5.5.7 Hi. Take a look at this for where to put Context elements: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html This is new with Tomcat 5.0 and is continued in Tomcat 5.5 --David Scott Purcell wrote: Hello, I am following the information here to add DBCP to my application. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html I am reading to add the Context path=/DBTest ... from the above docs. The instructions say to . Configure the JNDI DataSource in Tomcat by adding a declaration for your resource to $CATALINA_HOME/conf/server.xml. Add this in between the /Context tag of the examples context and the /Host tag closing the localhost definition. So cool, I opened up the server.xml, but do not see any existing context or host tags in it. Here is my server.xml file. Does anyone know where I put the Context for the DBCP stuff? Thanks, '!-- Example Server Configuration File -- !-- Note
Re: DBCP Please Help Get Working Properly
Aren't debug levels in TC 5.5 inactive? Will need to set up log4j. Bob On Apr 8, 2005 5:15 PM, Jay Burgess [EMAIL PROTECTED] wrote: Do you have anything in your Tomcat log files that might help? If not, you can bump up the debug levels in server.xml and you might get some more info. I also found that adding one of the two following listeners in my server.xml helped me debug my DBCP problems (I don't remember which one I added, but it should be obvious): Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=9/ Listener className=org.apache.catalina.core.NamingContextListener debug=9/ Jay Vertical Technology Group http://www.vtgroup.com/ -Original Message- From: Scott Purcell [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 3:08 PM To: Tomcat Users List Subject: DBCP Please Help Get Working Properly Hello, I am trying to use the DBCP features of Tomcat 5.5.7. I created a webapp named testDB and put it under $CATALINA_HOME/webapps/testDB. Then I created a testDB.xml file under $CATALINA_HOME/conf/Catalina/localhost/testDB.xml. // here it is Context path=/testDB docBase=testDB debug=5 reloadable=true crossContext=true Resource name=jdbc/testDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fritest?autoReconnect=true/ /Context I have been following the notes from: http://localhost/tomcat-docs/jndi-datasource-examples-howto.html I made sure I completed the rest of the tasks. WEB-INF has the two tag locations, and the resource ref. eg: taglib taglib-uri/WEB-INF/sql.tld/taglib-uri taglib-location/WEB-INF/sql.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib resource-ref descriptionDB Connection/description res-ref-namejdbc/testDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I finally hit my jsp page which is this: %@ taglib uri=http://java.sun.com/jsp/jstl/sql; prefix=sql % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % sql:query var=rs dataSource=jdbc/testDB select id, foo, bar from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} Foo ${row.foo}br/ Bar ${row.bar}br/ /c:forEach /body /html And I get no results: Now I am pretty sure I have all configured. Because if I use a fallback (Tomcat 4.1) code piece I had, I get results using the same settings: package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/testDB); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); while(rst.next()) { System.out.println(next ); foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } And using the above class works all day. The only difference I see is that the class using a naming import and the jsp does not. Can anyone help. Thanks, Scott -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 1:14 PM To: Tomcat Users List Subject: Re: Add Context Path, Tomcat 5.5.7 Hi. Take a look at this for where to put Context elements: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html This is new with Tomcat 5.0 and is continued in Tomcat 5.5 --David Scott Purcell wrote: Hello, I am following the information here to add DBCP to my application. http://jakarta.apache.org/tomcat/tomcat-5.5-doc/jndi-datasource-examples-howto.html I am reading to add the Context path=/DBTest ... from the above docs. The instructions say to . Configure the JNDI DataSource in Tomcat by adding a declaration for your resource to $CATALINA_HOME/conf/server.xml. Add this in between the /Context tag of the examples context and the /Host tag
RE: DBCP Please Help Get Working Properly
My apologies, we're using 5.0.x and I hadn't realized they went away. But maybe the logs still will provide some useful info? Jay Vertical Technology Group http://www.vtgroup.com/ -Original Message- From: Robert Harrison [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 4:20 PM To: Tomcat Users List Subject: Re: DBCP Please Help Get Working Properly Aren't debug levels in TC 5.5 inactive? Will need to set up log4j. Bob On Apr 8, 2005 5:15 PM, Jay Burgess [EMAIL PROTECTED] wrote: Do you have anything in your Tomcat log files that might help? If not, you can bump up the debug levels in server.xml and you might get some more info. I also found that adding one of the two following listeners in my server.xml helped me debug my DBCP problems (I don't remember which one I added, but it should be obvious): Listener className=org.apache.catalina.mbeans.GlobalResourcesLifecycleListener debug=9/ Listener className=org.apache.catalina.core.NamingContextListener debug=9/ Jay Vertical Technology Group http://www.vtgroup.com/ -Original Message- From: Scott Purcell [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 3:08 PM To: Tomcat Users List Subject: DBCP Please Help Get Working Properly Hello, I am trying to use the DBCP features of Tomcat 5.5.7. I created a webapp named testDB and put it under $CATALINA_HOME/webapps/testDB. Then I created a testDB.xml file under $CATALINA_HOME/conf/Catalina/localhost/testDB.xml. // here it is Context path=/testDB docBase=testDB debug=5 reloadable=true crossContext=true Resource name=jdbc/testDB auth=Container type=javax.sql.DataSource maxActive=100 maxIdle=30 maxWait=1 username=javauser password=javadude driverClassName=com.mysql.jdbc.Driver url=jdbc:mysql://localhost:3306/fritest?autoReconnect=true/ /Context I have been following the notes from: http://localhost/tomcat-docs/jndi-datasource-examples-howto.html I made sure I completed the rest of the tasks. WEB-INF has the two tag locations, and the resource ref. eg: taglib taglib-uri/WEB-INF/sql.tld/taglib-uri taglib-location/WEB-INF/sql.tld/taglib-location /taglib taglib taglib-uri/WEB-INF/c.tld/taglib-uri taglib-location/WEB-INF/c.tld/taglib-location /taglib resource-ref descriptionDB Connection/description res-ref-namejdbc/testDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref I finally hit my jsp page which is this: %@ taglib uri=http://java.sun.com/jsp/jstl/sql; prefix=sql % %@ taglib uri=http://java.sun.com/jsp/jstl/core; prefix=c % sql:query var=rs dataSource=jdbc/testDB select id, foo, bar from testdata /sql:query html head titleDB Test/title /head body h2Results/h2 c:forEach var=row items=${rs.rows} Foo ${row.foo}br/ Bar ${row.bar}br/ /c:forEach /body /html And I get no results: Now I am pretty sure I have all configured. Because if I use a fallback (Tomcat 4.1) code piece I had, I get results using the same settings: package foo; import javax.naming.*; import javax.sql.*; import java.sql.*; public class DBTest { String foo = Not Connected; int bar = -1; public void init() { try{ Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(Boom - No Context); DataSource ds = (DataSource)ctx.lookup( java:comp/env/jdbc/testDB); if (ds != null) { Connection conn = ds.getConnection(); if(conn != null) { foo = Got Connection +conn.toString(); Statement stmt = conn.createStatement(); ResultSet rst = stmt.executeQuery( select id, foo, bar from testdata); while(rst.next()) { System.out.println(next ); foo=rst.getString(2); bar=rst.getInt(3); } conn.close(); } } }catch(Exception e) { e.printStackTrace(); } } public String getFoo() { return foo; } public int getBar() { return bar;} } And using the above class works all day. The only difference I see is that the class using a naming import and the jsp does not. Can anyone help. Thanks, Scott -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Friday, April 08, 2005 1:14 PM To: Tomcat Users List Subject: Re: Add Context Path, Tomcat 5.5.7 Hi. Take a look at this for where to put Context elements: http://jakarta.apache.org/tomcat/tomcat-5.5-doc/config/context.html This is new with Tomcat 5.0 and is continued in Tomcat 5.5 --David Scott Purcell wrote: Hello, I am following the information here to add DBCP to my application. http
Re: [DBCP] Management of transactions...
This is the worst english I've seen so far. It's almost worse than mine. Viorel Dragomir . .. --- - Original Message - From: ksv To: tomcat-user@jakarta.apache.org Sent: Tuesday, January 25, 2005 17:52 Subject: [DBCP] Management of transactions... [DBCP] Management of transactions... [DBCP] Management of transactions... [DBCP] Management of transactions... Hello , Interests everything, that is connected to managements of transactions at use DBCP... Who Can will share experience or links? The database is not essential. The principle of work with transactions through DBCP is necessary... -- Best regards, ksv mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [DBCP] Management of transactions...
I think what he meant to say was: Hi, I would want to know how does DBCP handles transactions. I would be glad if someone could share their experiences or links with info. Regards KSV Ok, maybe my english is a little bit worse :P -Original Message- From: Viorel Dragomir [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 25, 2005 10:00 AM To: ksv; tomcat-user@jakarta.apache.org Subject: Re: [DBCP] Management of transactions... This is the worst english I've seen so far. It's almost worse than mine. Viorel Dragomir . .. --- - Original Message - From: ksv To: tomcat-user@jakarta.apache.org Sent: Tuesday, January 25, 2005 17:52 Subject: [DBCP] Management of transactions... [DBCP] Management of transactions... [DBCP] Management of transactions... [DBCP] Management of transactions... Hello , Interests everything, that is connected to managements of transactions at use DBCP... Who Can will share experience or links? The database is not essential. The principle of work with transactions through DBCP is necessary... -- Best regards, ksv mailto:[EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP/DB2/Tomcat 4.1.24 problem!
Hi Andreas, I think your comments would help me if I was having the opposite problem. In other words, if I was using the Class.forName... That works fine, it is the DBCP code that is failing. James -Original Message- From: Andreas Vombach [mailto:[EMAIL PROTECTED] Sent: December 21, 2004 1:51 AM To: Tomcat Users List Subject: Re: DBCP/DB2/Tomcat 4.1.24 problem! James, please see my message in Tomcat 5.5 classloading blues from 20.12 and the following. Cheers Andreas - 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: DBCP/DB2/Tomcat 4.1.24 problem!
James, please see my message in Tomcat 5.5 classloading blues from 20.12 and the following. Cheers Andreas - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP/JNDI/Realms
Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.java (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatemen t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPrepare dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delegatin gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm.j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSour ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j ava( Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:438 ) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm. java :277) [snip] So, what I've done now to see if it helps matters any, is specify the AS400's own connection pool factory in my JNDI definition, like so: parameter namefactory/name valuecom.ibm.as400.access.AS400JDBCConnectionPoolDataSource/value /parameter Both Tomcat's form authentication as well as my application (through iBATiS) use this JNDI DataSource for connections. Can anyone shed more light on what the root cause of the problem is here? Should DBCP gracefully recover? Regards, Brice Ruth -- Brice Ruth, Sr. IT Analyst Fiskars Brands Inc http://www.fiskarsbrands.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: DBCP/JNDI/Realms
Follow-up question. Should I or should I not use the ConnectionPool implementation provided by IBM in their JDBC driver? And if I should, do the parameters provided by DBCP still apply? I have to admit, I'm a bit fuzzy on what role which component is playing in this game! Thanks!! Shapira, Yoav wrote: Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.java( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.java (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatemen t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPrepare dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCConn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delegatin gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm.j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSour ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j ava( Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:438 ) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRealm. java :277) [snip] So, what I've done now to see if it helps matters any, is specify the AS400's own connection pool factory in my JNDI definition, like so: parameter namefactory/name valuecom.ibm.as400.access.AS400JDBCConnectionPoolDataSource/value /parameter Both Tomcat's form authentication as well as my application (through iBATiS) use this JNDI DataSource for connections. Can anyone shed more light on what the root cause of the problem is here? Should DBCP gracefully recover? Regards, Brice Ruth -- Brice Ruth, Sr. IT Analyst Fiskars Brands Inc http://www.fiskarsbrands.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] -- Brice Ruth, Sr. IT Analyst Fiskars Brands Inc http://www.fiskarsbrands.com/
RE: DBCP/JNDI/Realms
Hi, The DBCP parameters are for DBCP. DBCP won't magically set various properties on your IBM driver, so if you want those set you have to do it yourself. If you use IBM's pooling, as opposed to IBM's driver with DBCP's pooling, you can set those properties in your Tomcat xml configuration, as long as the factory provided by IBM supports that approach. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 3:31 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms Follow-up question. Should I or should I not use the ConnectionPool implementation provided by IBM in their JDBC driver? And if I should, do the parameters provided by DBCP still apply? I have to admit, I'm a bit fuzzy on what role which component is playing in this game! Thanks!! Shapira, Yoav wrote: Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.jav a( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.jav a( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.ja va (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatem en t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPrepa re dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCCo nn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCCo nn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delegat in gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper. pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm .j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSo ur ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource .j ava( Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:4 38 ) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceReal m. java :277) [snip] So, what I've done now to see if it helps matters any, is specify the AS400's own connection pool factory in my JNDI definition, like so: parameter namefactory/name valuecom.ibm.as400.access.AS400JDBCConnectionPoolDataSource/value /parameter Both Tomcat's form authentication as well as my application (through iBATiS) use this JNDI DataSource for connections. Can anyone shed more light on what the root cause of the problem is here? Should DBCP gracefully recover? Regards, Brice Ruth -- Brice Ruth, Sr. IT Analyst Fiskars Brands Inc http://www.fiskarsbrands.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
RE: DBCP/JNDI/Realms
I use Oracle but I don't use Oracle's implementation of pooling because I found DBCP + commons-pooling did a great job in connection pooling. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: December 6, 2004 3:33 PM To: Tomcat Users List Subject: RE: DBCP/JNDI/Realms Hi, The DBCP parameters are for DBCP. DBCP won't magically set various properties on your IBM driver, so if you want those set you have to do it yourself. If you use IBM's pooling, as opposed to IBM's driver with DBCP's pooling, you can set those properties in your Tomcat xml configuration, as long as the factory provided by IBM supports that approach. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 3:31 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms Follow-up question. Should I or should I not use the ConnectionPool implementation provided by IBM in their JDBC driver? And if I should, do the parameters provided by DBCP still apply? I have to admit, I'm a bit fuzzy on what role which component is playing in this game! Thanks!! Shapira, Yoav wrote: Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.jav a( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.jav a( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.ja va (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatem en t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPrepa re dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCCo nn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCCo nn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delegat in gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper. pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm .j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSo ur ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource .j ava( Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:4 38 ) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceReal m. java :277) [snip] So, what I've done now to see if it helps matters any, is specify the AS400's own connection pool factory in my JNDI definition, like so: parameter namefactory/name valuecom.ibm.as400.access.AS400JDBCConnectionPoolDataSource/value /parameter Both Tomcat's form authentication as well as my application (through iBATiS) use this JNDI DataSource for connections. Can anyone shed more light on what the root cause of the problem is here? Should DBCP gracefully recover? Regards, Brice Ruth -- Brice Ruth, Sr. IT Analyst Fiskars Brands Inc http://www.fiskarsbrands.com
Re: DBCP/JNDI/Realms
OK, so short of waiting for this to fail again, how might I go about testing this works? Should I see if the database folks can kill the JDBC connections manually? Shapira, Yoav wrote: Hi, The DBCP parameters are for DBCP. DBCP won't magically set various properties on your IBM driver, so if you want those set you have to do it yourself. If you use IBM's pooling, as opposed to IBM's driver with DBCP's pooling, you can set those properties in your Tomcat xml configuration, as long as the factory provided by IBM supports that approach. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 3:31 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms Follow-up question. Should I or should I not use the ConnectionPool implementation provided by IBM in their JDBC driver? And if I should, do the parameters provided by DBCP still apply? I have to admit, I'm a bit fuzzy on what role which component is playing in this game! Thanks!! Shapira, Yoav wrote: Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.jav a( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.jav a( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.ja va (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStatem en t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPrepa re dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCCo nn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCCo nn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delegat in gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper. pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRealm .j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSo ur ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource .j ava( Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java:4 38 ) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceReal m. java :277) [snip] So, what I've done now to see if it helps matters any, is specify the AS400's own connection pool factory in my JNDI definition, like so: parameter namefactory/name valuecom.ibm.as400.access.AS400JDBCConnectionPoolDataSource/value /parameter Both Tomcat's form authentication as well as my application (through iBATiS) use this JNDI DataSource for connections. Can anyone shed more
RE: DBCP/JNDI/Realms
Hi, Your DBAs should be able to help you here: they should definitely be able to kill connections. If it's a test database, they can simply bring it down for a few minutes, then back up, while you keep your Tomcat running. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 4:22 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms OK, so short of waiting for this to fail again, how might I go about testing this works? Should I see if the database folks can kill the JDBC connections manually? Shapira, Yoav wrote: Hi, The DBCP parameters are for DBCP. DBCP won't magically set various properties on your IBM driver, so if you want those set you have to do it yourself. If you use IBM's pooling, as opposed to IBM's driver with DBCP's pooling, you can set those properties in your Tomcat xml configuration, as long as the factory provided by IBM supports that approach. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 3:31 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms Follow-up question. Should I or should I not use the ConnectionPool implementation provided by IBM in their JDBC driver? And if I should, do the parameters provided by DBCP still apply? I have to admit, I'm a bit fuzzy on what role which component is playing in this game! Thanks!! Shapira, Yoav wrote: Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.j av a( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.j av a( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement. ja va (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCStat em en t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPre pa re dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBC Co nn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBC Co nn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Deleg at in gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrappe r. pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceRea lm .j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingData So ur ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSour ce .j ava( Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.open(DataSourceRealm.java :4 38 ) at org.apache.catalina.realm.DataSourceRealm.authenticate(DataSourceRe al m. java :277) [snip] So, what I've done now to see if it helps matters any, is specify the AS400's own connection pool factory in my JNDI definition, like so: parameter namefactory/name valuecom.ibm.as400
RE: DBCP/JNDI/Realms
I am not sure I understand your question. But in my trails, if my JNDI resource is in GlobalNamingResources, those connection won't be killed unless I shutdown tomcat. If my resource is in my own context, I have to kill them when I stop my application. -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: December 6, 2004 4:22 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms OK, so short of waiting for this to fail again, how might I go about testing this works? Should I see if the database folks can kill the JDBC connections manually? Shapira, Yoav wrote: Hi, The DBCP parameters are for DBCP. DBCP won't magically set various properties on your IBM driver, so if you want those set you have to do it yourself. If you use IBM's pooling, as opposed to IBM's driver with DBCP's pooling, you can set those properties in your Tomcat xml configuration, as long as the factory provided by IBM supports that approach. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 3:31 PM To: Tomcat Users List Subject: Re: DBCP/JNDI/Realms Follow-up question. Should I or should I not use the ConnectionPool implementation provided by IBM in their JDBC driver? And if I should, do the parameters provided by DBCP still apply? I have to admit, I'm a bit fuzzy on what role which component is playing in this game! Thanks!! Shapira, Yoav wrote: Hi, DBCP will NOT gracefully recover by itself. You need to configure it according to your desired behavior. Specifically, check out the testOnBorrow, testOnReturn, and testWhileIdle properties at http://jakarta.apache.org/commons/dbcp/configuration.html. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Ruth, Brice [mailto:[EMAIL PROTECTED] Sent: Monday, December 06, 2004 11:32 AM To: Tomcat Users List Subject: DBCP/JNDI/Realms Good morning! I've been running into an intermittent problem with my database connections for authentication. It appears that periodically, the iSeries (DB2/400) that I connect to terminates all incoming ODBC/JDBC connections (one a week, apparently). What happens in my application is that users can no longer login after the connections have been dropped. The connection pool apparently doesn't try to re-initiate the connections after they've been dropped. I see an exception in my logs regarding the connection being reset, then I see an exception relating to the pool being exhausted. I'm not entirely sure what the root cause of the problem here is - in theory, DBCP should recover gracefully when a connection is reset/dropped, right? Here's the initial exception: java.sql.SQLException: Communication link failure.(Connection was dropped unexpectedly.) at com.ibm.as400.access.JDError.throwSQLException(JDError.java:365) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.ja v a( Comp iled Code)) at com.ibm.as400.access.AS400JDBCConnection.send(AS400JDBCConnection.ja v a( Inli ned Compiled Code)) at com.ibm.as400.access.AS400JDBCStatement.syncRPB(AS400JDBCStatement.j a va (Com piled Code)) at com.ibm.as400.access.AS400JDBCStatement.commonPrepare(AS400JDBCState m en t.ja va(Compiled Code)) at com.ibm.as400.access.AS400JDBCPreparedStatement.init(AS400JDBCPrep a re dSta tement.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCC o nn ecti on.java(Compiled Code)) at com.ibm.as400.access.AS400JDBCConnection.prepareStatement(AS400JDBCC o nn ecti on.java(Compiled Code)) at org.apache.commons.dbcp.DelegatingConnection.prepareStatement(Delega t in gCon nection.java(Compiled Code)) at org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper . pr epar eStatement(PoolingDataSource.java(Compiled Code)) at org.apache.catalina.realm.DataSourceRealm.credentials(DataSourceReal m .j ava: 460) [snip] Here's the next one: 2004-12-06 04:39:21 DataSourceRealm[]: Exception performing authentication org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataS o ur ce.j ava(Compiled Code)) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSourc e .j ava( Compiled Code
RE: [dbcp] Call Oracle stored procedure via DBCP?
If you need to get the underlying connection, ((BasicDataSource) dataSource).setAccessToUnderlyingConnectionAllowed(true); Before you can getConnection. -Original Message- From: Shankar Unni [mailto:[EMAIL PROTECTED] Sent: December 1, 2004 5:32 PM To: [EMAIL PROTECTED] Subject: Re: [dbcp] Call Oracle stored procedure via DBCP? Sergey Karpov wrote: During a call of stored procedure through DBCP there is a mistake of reduction of type: java.lang.ClassCastException That's because you're assuming that dbcp returns you a naked vendor JDBC Connection object. It doesn't - it returns you a pooled connection wrapper with forwarding methods. Ditto for CallableStatements. If you really needed to get the underlying object, you'd have to look at the JavaDoc for DBCP. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] !DSPAM:41ae4678152041696882794!
Re: [dbcp] Call Oracle stored procedure via DBCP?
Sergey Karpov wrote: During a call of stored procedure through DBCP there is a mistake of reduction of type: java.lang.ClassCastException That's because you're assuming that dbcp returns you a naked vendor JDBC Connection object. It doesn't - it returns you a pooled connection wrapper with forwarding methods. Ditto for CallableStatements. If you really needed to get the underlying object, you'd have to look at the JavaDoc for DBCP. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP Pooling loggin
Hi, Under tomcat 5.0, what is the best way to configure logging for commons-DBCP? Can this be done using log4j? You have to do it programmatically, using BasicDataSource#setLogWriter. This is the only logging supported by DBCP right now. It's tricky to mix it with other logging such as that done by Tomcat. Yoav 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: DBCP doesn't see .jar in context ???
Hi, I am trying to use the DriverAdapterCPDS in DBCP. When I run my eclipse app standalone to test my class, the cpds.setDriver(strDriver); function works Running your app in an IDE is not the same as running it standalone, and means you're subject to whatever classpath the IDE assigns. However, When I kick off tomcat, my classpath is set to Bootstrap.jar (and As the Classloader how-to explains, there are numerous different classpaths within Tomcat. The Bootstrap classpath is not related to your app classpath, and should not contain DBCP or any DB driver jars. I know this can be solved by putting my driver .jar file in the tomcat/common/lib directory, but I would prefer not to do that. I would prefer to have all my project related .jar files in WEB-INF/lib. Then you must put DBCP there as well, and configure it yourself. The DBCP jar and the DB driver jar should be in the same classloader repository. Is there a way to change the classpath dynamically? Only if you write your own custom classloader and plug it into Tomcat. But that's more trouble than it's worth usually. Yoav 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: DBCP Parameters
Thanks, you 've been very clear. - Original Message - From: Edson Alves Pereira [EMAIL PROTECTED] To: 'Tomcat Users List' [EMAIL PROTECTED] Sent: Tuesday, October 05, 2004 4:25 PM Subject: RES: DBCP Parameters That´s because DBCP when reach its limit it create a new connection to suplay the demand, after all connection without use are released your current connections come back to 3 connection in pool as you setted to 3 max connection alive in the pool. Regards, Edson -Mensagem original- De: Leonardo Larraquy [mailto:[EMAIL PROTECTED] Enviada em: terça-feira, 5 de outubro de 2004 16:15 Para: Tomcat Users List Assunto: DBCP Parameters Hi everyone. I've just made my application work with an SQL Server Datasource, wich is written below. It's working fine, but there's one problem (or not), so I want to ask you folks. As you can see I put at the parameter maxConnections a value of 3. Then I made a test, getting a Connection from the pool within a for loop. I was able to get over 1 connections, and I stoped the test. With dind't I get a Connection Pool exasusted error at the fourth iteration??? Thanks in advance. Resource name=jdbc/sql2000 auth=Container type=com.microsoft.jdbcx.sqlserver.SQLServerDataSource/ ResourceParams name=jdbc/sql2000 parameter namefactory/name valuecom.microsoft.jdbcx.sqlserver.SQLServerDataSourceFactory/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbcx.sqlserver.SQLServerDataSource/value /parameter parameter namedriverName/name valueSQLServer/value /parameter parameter namedescription/name valueSQL Server DataSource/value /parameter parameter nameserverName/name valueJK008/value /parameter parameter nameportNumber/name value1433/value /parameter parameter nameselectMethod/name valuecursor/value /parameter parameter namedatabaseName/name valueseguridad/value /parameter parameter nameuser/name valuepuma/value /parameter parameter namepassword/name valuepuma/value /parameter parameter namemaxConnections/name value3/value /parameter parameter nameminConnections/name value1/value /parameter parameter nameloginTimeout/name value3000/value /parameter parameter namecheckEvery/name value6/value /parameter parameter nameidleTimeout/name value50/value /parameter /ResourceParams Leonardo Lopez Larraquy Jakarta Ingenieria de Software www.jakartasrl.com.ar - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP Performance?
Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: DBCP Performance? Hi, has enyone of you recently measured the performance of the DBCP Connection Pool? I compared snip long start = System.currentTimeMillis(); Class.forName(ca.edbc.jdbc.EdbcDriver); Connection dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPa$ long diff = System.currentTimeMillis() - start; System.out.println(creating connection without pool took: + diff + mil$ /snip with snip long start = System.currentTimeMillis(); Connection dbcon = ds.getConnection( ); long diff = System.currentTimeMillis() - start; System.out.println(creating connection with pool took: + diff + milise$ /snip And got surprisingly results like this: creating connection without pool took: 465 miliseconds creating connection with pool took: 585 miliseconds In my tests the connection pool is always slower, so what did I do wrong? I guess this Parameter is responsible for holding active Connections in the Pool: parameter nameinitialSize/name value20/value /parameter So there shold be active Connections before the getConnection( ) is called .. Any ideas? Regards, Henrik - 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: DBCP Performance?
Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: DBCP Performance? Hi, has enyone of you recently measured the performance of the DBCP Connection Pool? I compared snip long start = System.currentTimeMillis(); Class.forName(ca.edbc.jdbc.EdbcDriver); Connection dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPa$ long diff = System.currentTimeMillis() - start; System.out.println(creating connection without pool took: + diff + mil$ /snip with snip long start = System.currentTimeMillis(); Connection dbcon = ds.getConnection( ); long diff = System.currentTimeMillis() - start; System.out.println(creating connection with pool took: + diff + milise$ /snip And got surprisingly results like this: creating connection without pool took: 465 miliseconds creating connection with pool took: 585 miliseconds In my tests the connection pool is always slower, so what did I do wrong? I guess this Parameter is responsible for holding active Connections in the Pool: parameter nameinitialSize/name value20/value /parameter So there shold be active Connections before the getConnection( ) is called .. Any ideas? Regards, Henrik - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP Performance?
Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: DBCP Performance? Hi, has enyone of you recently measured the performance of the DBCP Connection Pool? I compared snip long start = System.currentTimeMillis(); Class.forName(ca.edbc.jdbc.EdbcDriver); Connection dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPa$ long diff = System.currentTimeMillis() - start; System.out.println(creating connection without pool took: + diff + mil$ /snip with snip long start = System.currentTimeMillis(); Connection dbcon = ds.getConnection( ); long diff = System.currentTimeMillis() - start; System.out.println(creating connection with pool took: + diff + milise$ /snip And got surprisingly results like this: creating connection without pool took: 465 miliseconds creating connection with pool took: 585 miliseconds In my tests the connection pool is always slower, so what did I do wrong? I guess this Parameter is responsible for holding active Connections in the Pool: parameter nameinitialSize/name value20/value /parameter So there shold be active Connections before the getConnection( ) is called .. Any ideas? Regards, Henrik - 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] - 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: DBCP Performance?
Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: DBCP Performance? Hi, has enyone of you recently measured the performance of the DBCP Connection Pool? I compared snip long start = System.currentTimeMillis(); Class.forName(ca.edbc.jdbc.EdbcDriver); Connection dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPa$ long diff = System.currentTimeMillis() - start; System.out.println(creating connection without pool took: + diff + mil$ /snip with snip long start = System.currentTimeMillis(); Connection dbcon = ds.getConnection( ); long diff = System.currentTimeMillis() - start; System.out.println(creating connection with pool took: + diff + milise$ /snip And got surprisingly results like this: creating connection without pool took: 465 miliseconds creating connection with pool took: 585 miliseconds In my tests the connection pool is always slower, so what did I do wrong? I guess this Parameter is responsible for holding active Connections in the Pool: parameter nameinitialSize/name value20/value /parameter So there shold be active Connections before the getConnection( ) is called .. Any ideas? Regards, Henrik
RE: DBCP Performance?
Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: DBCP Performance? Hi, has enyone of you recently measured the performance of the DBCP Connection Pool? I compared snip long start = System.currentTimeMillis(); Class.forName(ca.edbc.jdbc.EdbcDriver); Connection dbcon = DriverManager.getConnection(loginUrl, loginUser, loginPa$ long diff = System.currentTimeMillis() - start; System.out.println(creating connection without pool took: + diff + mil$ /snip with snip long start = System.currentTimeMillis(); Connection dbcon = ds.getConnection( ); long diff = System.currentTimeMillis() - start; System.out.println(creating connection with pool took: + diff + milise$ /snip And got surprisingly results like this: creating connection without pool took: 465 miliseconds creating connection with pool took: 585 miliseconds In my tests the connection pool is always
Re: DBCP Performance?
Hi, I tried your settings, but getNumIdle() still returns 0. Why that? The maxActive value was 0 because i thought this is neccesary to let the pool never run out of connections: http://jakarta.apache.org/commons/dbcp/configuration.html maxActive default:8The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. cheers, Henrik On Fri, 10 Sep 2004 12:23:40 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:16 AM To: [EMAIL PROTECTED] Subject: DBCP Performance? Hi, has enyone of you recently measured the performance of the DBCP Connection Pool? I compared snip long start = System.currentTimeMillis(); Class.forName(ca.edbc.jdbc.EdbcDriver
Re: DBCP Performance?
I have to correct myself: getNumIdle() returned 19 after a little bit of waiting. but getConnection( ) still takes 1238 miliseconds. Henrik On Fri, 10 Sep 2004 18:47:46 +0200 Henrik Rathje [EMAIL PROTECTED] wrote: Hi, I tried your settings, but getNumIdle() still returns 0. Why that? The maxActive value was 0 because i thought this is neccesary to let the pool never run out of connections: http://jakarta.apache.org/commons/dbcp/configuration.html maxActive default:8The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. cheers, Henrik On Fri, 10 Sep 2004 12:23:40 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're creating a new connection each time, a tiny bit of overhead can be expected for a pool over a direct DriverManager call. But that defeats the purpose of pooling. If your pool is properly configured and has a connection waiting, it should be a little bit more than a hash lookup to return the connection, which would be significantly faster than creating a new one. Yoav Shapira Millennium Research Informatics
Re: DBCP Performance?
wow, that just seems wrong. Have you tried other jdbc drivers? I know from first hand experience with Oracle's jdbc driver, w/o pooling it's minimum of 100ms to get connection. With pooling, it's usually less than 5ms. peter On Fri, 10 Sep 2004 18:56:42 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: I have to correct myself: getNumIdle() returned 19 after a little bit of waiting. but getConnection( ) still takes 1238 miliseconds. Henrik On Fri, 10 Sep 2004 18:47:46 +0200 Henrik Rathje [EMAIL PROTECTED] wrote: Hi, I tried your settings, but getNumIdle() still returns 0. Why that? The maxActive value was 0 because i thought this is neccesary to let the pool never run out of connections: http://jakarta.apache.org/commons/dbcp/configuration.html maxActive default:8The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. cheers, Henrik On Fri, 10 Sep 2004 12:23:40 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test was: parameter nameminIdle/name value20/value /parameter any other suggestions? Thanks in advance, Henrik On Fri, 10 Sep 2004 11:21:08 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, The initial connections can be closed if idle, depending on your pool configuration, so you might be creating new connections each time even with the pool. Check your minIdle setting. If you're
Re: DBCP Performance?
hi, im note sure if there exists another jdbc driver for ingres beside the one i use. can this really be a driver issue? which connectionpool did you use while doing the measurements for your 'so you want high performance' paper? regards, henrik On Fri, 10 Sep 2004 12:02:13 -0500 Peter Lin [EMAIL PROTECTED] wrote: wow, that just seems wrong. Have you tried other jdbc drivers? I know from first hand experience with Oracle's jdbc driver, w/o pooling it's minimum of 100ms to get connection. With pooling, it's usually less than 5ms. peter On Fri, 10 Sep 2004 18:56:42 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: I have to correct myself: getNumIdle() returned 19 after a little bit of waiting. but getConnection( ) still takes 1238 miliseconds. Henrik On Fri, 10 Sep 2004 18:47:46 +0200 Henrik Rathje [EMAIL PROTECTED] wrote: Hi, I tried your settings, but getNumIdle() still returns 0. Why that? The maxActive value was 0 because i thought this is neccesary to let the pool never run out of connections: http://jakarta.apache.org/commons/dbcp/configuration.html maxActive default:8The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. cheers, Henrik On Fri, 10 Sep 2004 12:23:40 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence the slow performance. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 11:46 AM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, The minIdle value during this test
Re: DBCP Performance?
I used oracle's drivers :) since I'm most experienced with Oracle and I have it installed at home for development. peter On Fri, 10 Sep 2004 19:11:53 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: hi, im note sure if there exists another jdbc driver for ingres beside the one i use. can this really be a driver issue? which connectionpool did you use while doing the measurements for your 'so you want high performance' paper? regards, henrik On Fri, 10 Sep 2004 12:02:13 -0500 Peter Lin [EMAIL PROTECTED] wrote: wow, that just seems wrong. Have you tried other jdbc drivers? I know from first hand experience with Oracle's jdbc driver, w/o pooling it's minimum of 100ms to get connection. With pooling, it's usually less than 5ms. peter On Fri, 10 Sep 2004 18:56:42 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: I have to correct myself: getNumIdle() returned 19 after a little bit of waiting. but getConnection( ) still takes 1238 miliseconds. Henrik On Fri, 10 Sep 2004 18:47:46 +0200 Henrik Rathje [EMAIL PROTECTED] wrote: Hi, I tried your settings, but getNumIdle() still returns 0. Why that? The maxActive value was 0 because i thought this is neccesary to let the pool never run out of connections: http://jakarta.apache.org/commons/dbcp/configuration.html maxActive default:8The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. cheers, Henrik On Fri, 10 Sep 2004 12:23:40 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has available connections before the get connection call. You obviously wouldn't do this in a production application, but this is just for debugging a performance test. Cast the DataSource to the concrete implementation type, probably org.apache.commons.dbcp.BasicDataSource, and call getNumIdle on it to verify it's a positive number before calling getConnection. If it's zero or negative your pool is misconfigured and you're creating a new connection, hence
Re: DBCP Performance - solved.
Hi, i did not change any settings, no restart and no anything; but now the timings are: 67 miliseconds pool 956 miliseconds nopool. seems it simply takes several minutes until the pool is ready to use. sorry for asking those stupid questions + thanks for helping, Henrik On Fri, 10 Sep 2004 12:16:18 -0500 Peter Lin [EMAIL PROTECTED] wrote: I used oracle's drivers :) since I'm most experienced with Oracle and I have it installed at home for development. peter On Fri, 10 Sep 2004 19:11:53 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: hi, im note sure if there exists another jdbc driver for ingres beside the one i use. can this really be a driver issue? which connectionpool did you use while doing the measurements for your 'so you want high performance' paper? regards, henrik On Fri, 10 Sep 2004 12:02:13 -0500 Peter Lin [EMAIL PROTECTED] wrote: wow, that just seems wrong. Have you tried other jdbc drivers? I know from first hand experience with Oracle's jdbc driver, w/o pooling it's minimum of 100ms to get connection. With pooling, it's usually less than 5ms. peter On Fri, 10 Sep 2004 18:56:42 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: I have to correct myself: getNumIdle() returned 19 after a little bit of waiting. but getConnection( ) still takes 1238 miliseconds. Henrik On Fri, 10 Sep 2004 18:47:46 +0200 Henrik Rathje [EMAIL PROTECTED] wrote: Hi, I tried your settings, but getNumIdle() still returns 0. Why that? The maxActive value was 0 because i thought this is neccesary to let the pool never run out of connections: http://jakarta.apache.org/commons/dbcp/configuration.html maxActive default:8The maximum number of active connections that can be allocated from this pool at the same time, or zero for no limit. cheers, Henrik On Fri, 10 Sep 2004 12:23:40 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Try minIdle = 19, maxIdle = 20, maxActive = 20, initialSize = 20. I think the maxActive 0 effectively means no pooling. Yoav Shapira Millennium Research Informatics -Original Message- From: Henrik Rathje [mailto:[EMAIL PROTECTED] Sent: Friday, September 10, 2004 12:20 PM To: Tomcat Users List Subject: Re: DBCP Performance? Hi, seems you are rite: org.apache.commons.dbcp.BasicDataSource source = (org.apache.commons.dbcp.BasicDataSource)ds; System.out.println(num of idle connections + source.getNumIdle() ); System.out.println(num of max act connections + source.getMaxActive() ); System.out.println(username + source.getUsername() ); prints: num of idle connections 0 num of max act connections 0 username tomcat but why? here is the connection pool configuration: Resource name=jdbc/sdb-login auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sdb-login parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueca.edbc.jdbc.EdbcDriver/value /parameter parameter namepoolPreparedStatements/name valuetrue/value /parameter parameter namedefaultAutoCommit/name valuefalse/value /parameter parameter nameurl/name valuejdbc:edbc://localhost:IJ7/sdb/value /parameter parameter nameusername/name valuetomcat/value /parameter parameter namepassword/name valuepasswd ;-)/value /parameter parameter nameinitialSize/name value20/value /parameter parameter namemaxActive/name value0/value /parameter parameter namemaxIdle/name value0/value /parameter parameter nameminIdle/name value20/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nametestOnBorrow/name valuefalse/value /parameter /ResourceParams Thanks for support, Henrik On Fri, 10 Sep 2004 11:51:05 -0400 Shapira, Yoav [EMAIL PROTECTED] wrote: Hi, Hmm, with minIdle set to 20 and assuming your test gets one connection at a time (or less than 20 at a time), I'm a bit confused. One next step would be to really verify that the pool has
Re: DBCP Performance - solved.
it's an easy mistake to make. the usual trick to benchmark and performance testing is to prime the server a bit. we've all made that mistake at some point. peter On Fri, 10 Sep 2004 19:35:43 +0200, Henrik Rathje [EMAIL PROTECTED] wrote: Hi, i did not change any settings, no restart and no anything; but now the timings are: 67 miliseconds pool 956 miliseconds nopool. seems it simply takes several minutes until the pool is ready to use. sorry for asking those stupid questions + thanks for helping, Henrik - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP - monitoring connections
Hi, Yes, just cast the DataSource you get from the JNDI lookup to the concrete type (org.apache.commons.dbcp.BasicDataSource probably for you), and call its monitoring methods which are plentiful (see the DBCP JavaDocs for details). Yoav Shapira Millennium Research Informatics -Original Message- From: Antony Paul [mailto:[EMAIL PROTECTED] Sent: Thursday, September 09, 2004 1:48 AM To: [EMAIL PROTECTED] Subject: DBCP - monitoring connections Hi all, Is there any interface available with DBCP for monitoring no of active connections, connections requested, no of rejected connection requests,connections removed from pool. I should be capable of taking samples every 1 minute or so. Or is it possible to write a class which queries these information. rgds Antony Paul - 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: DBCP connection pooling by default?
Whoops...I need an addendum. The post can be found here: http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topicf=13t=001073 - Original message - From: Stephen Charles Huey [EMAIL PROTECTED] To: Tomcat User [EMAIL PROTECTED] Date: Mon, 16 Aug 2004 13:06:13 -0500 Subject: DBCP connection pooling by default? The 8th post in this Javaranch.com thread suggests that Tomcat uses DBCP connection pooling by default: http://www.midrangeserver.com/mpo/mpo081502-story04.html That feature to indicate connection leaks sounds intriguing. I found the following in our server.xml and am wondering if this means we are definitely using this Commons DBCP: - !-- Define the top level container in our container hierarchy -- - Engine name=Standalone defaultHost=localhost debug=0 - DefaultContext crossContext=true Resource name=jdbc/myResource auth=Container type=javax.sql.DataSource / - ResourceParams name=jdbc/myResource - parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter I think we are NOT using it because we have some Java classes that are intended to handle connection pooling, and they look similar to some of the textbook ones floating around online. I'm just wondering if there would be connection pooling in place with the above XML if we didn't somehow override that with our own connection pooling classes. One other thing is that we currently have to use the JDBC-ODBC bridge, so I don't know if that would have anything to do with it. Thanks, Stephen - 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: DBCP in Tomcat 5.0: must deploy some artifacts in /common/lib(classes) ?!
Hi, That's because Tomcat bundles DBCP. If you want to separate them completely, put your copy in WEB-INF/lib, and the bundled copy in server/lib, and nothing for DBCP in the common or shared classloader repositories. Yoav Shapira Millennium Research Informatics -Original Message- From: Jerome Lacoste [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 27, 2004 3:33 PM To: Tomcat User Subject: DBCP in Tomcat 5.0: must deploy some artifacts in /common/lib(classes) ?! Hi, I am deploying a J2EE app in Tomcat 5.0.27. The application uses commons-dbcp. I've found out that if I don't put the jocl file AND the DB drivers in the $CATALINA_HOME/common/lib/ (classes) directory, the DBCP would fail. Either the config file is not found Caused by: java.sql.SQLException: Configuration file not found at org.apache.commons.dbcp.PoolingDriver.getConnectionPool (PoolingDriver.java:132) at org.apache.commons.dbcp.PoolingDriver.connect (PoolingDriver.java:170) at java.sql.DriverManager.getConnection(DriverManager.java:512) at java.sql.DriverManager.getConnection(DriverManager.java:193) of the drivers are not found (even if registered manually) or . Caused by: java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java:532) at java.sql.DriverManager.getConnection(DriverManager.java:171) at org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection (DriverManagerConnectionFactory.java:48) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject (PoolableConnectionFactory.java:290) at org.apache.commons.pool.impl.GenericObjectPool.borrowObject (GenericObjectPool.java:771) at org.apache.commons.dbcp.PoolingDriver.connect (PoolingDriver.java:175) I've tried to put those in the WEB-INF/lib/ (classes) and the shared/lib/ (classes) but none solution worked. That sounds like a ClassLoader issue to me, but according to the Tomcat 5.0 doc, I am doing the right thing. Putting them in common/lib is a workaround I can accept now, but not for long! I am at a loss then. Is that problem specific to DBCP? Any idea? Cheers, Jerome - 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: DBCP in Tomcat 5.0: must deploy some artifacts in /common/lib(classes) ?!
On Tue, 2004-07-27 at 15:34 -0400, Shapira, Yoav wrote: Hi, That's because Tomcat bundles DBCP. If you want to separate them completely, put your copy in WEB-INF/lib, and the bundled copy in server/lib, and nothing for DBCP in the common or shared classloader repositories. I still don't get why it doesn't work. The Tomcat ClassLoader doc [1] says: When a request to load a class from the web application's WebappX class loader is processed, this class loader will look in the local repositories first, instead of delegating before looking. To me that would mean that the ClassLoader that tries to load these classes is not the web application ClassLoader, otherwise the files would be loaded. But my application seems to be the one that tries to load the class/resource: the failure to load the resource happens below the web application's code and not in some special tomcat initialization code. Is it possible for you (or someone else) to explain me why ? And second point, this seems to go against the notes made in the Tomcat 5.0 documentation. Maybe a note on that particular case should be done, as Tomcat bundle DBCP, and many might encounter the problem? Yoav Shapira Millennium Research Informatics Jerome [1] http://jakarta.apache.org/tomcat/tomcat-5.0-doc/class-loader- howto.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP + Tomcat Issues?
Hi, It IS a shot in the dark when you give that little context. What's the stack trace of the SQL exception? Yoav Shapira Millennium Research Informatics -Original Message- From: Rahman Syed [mailto:[EMAIL PROTECTED] Sent: Monday, July 26, 2004 2:35 PM To: [EMAIL PROTECTED] Subject: DBCP + Tomcat Issues? Hello, I realize this may not be the best place to ask but I'll give it a shot. I'm using DBCP in a Struts application to make requests to MySQL DB and simply return results for Select queries. The application works fine for a while then for some reason stops; it throws SQLExceptions whenever I try to create a Statement. If I restart Tomcat, things are fine again. Might be a shot in the dark to ask here, but does anyone have any idea? Thanks in advance. Rahman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP + Tomcat Issues?
What are the sql exceptions? Looks like the connections arent beeing released in the connection pool. Eventually they all are beeing used. Rahman Syed wrote: Hello, I realize this may not be the best place to ask but I'll give it a shot. I'm using DBCP in a Struts application to make requests to MySQL DB and simply return results for Select queries. The application works fine for a while then for some reason stops; it throws SQLExceptions whenever I try to create a Statement. If I restart Tomcat, things are fine again. Might be a shot in the dark to ask here, but does anyone have any idea? Thanks in advance. Rahman - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP + Tomcat Issues?
http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations Look at the link. Make sure you are closing the connections. Anastasios Angelidis wrote: What are the sql exceptions? Looks like the connections arent beeing released in the connection pool. Eventually they all are beeing used. Rahman Syed wrote: Hello, I realize this may not be the best place to ask but I'll give it a shot. I'm using DBCP in a Struts application to make requests to MySQL DB and simply return results for Select queries. The application works fine for a while then for some reason stops; it throws SQLExceptions whenever I try to create a Statement. If I restart Tomcat, things are fine again. Might be a shot in the dark to ask here, but does anyone have any idea? Thanks in advance. Rahman - 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: DBCP pool
what timeout? the amount of time it keeps an idle connection in the pool? the amount of time it waits before considering a connection abandoned? -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 2:40 PM To: Tomcat Users List Subject: DBCP pool Is there a way to set the database timeout in dbcp??? I have a database which I have no control under its timeout. I used a pool api that allowed me to set the database timeout, but as I want to move to DBCP, is there a way to set this??? -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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: DBCP pool
none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. Mike Curwen wrote: what timeout? the amount of time it keeps an idle connection in the pool? the amount of time it waits before considering a connection abandoned? -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 2:40 PM To: Tomcat Users List Subject: DBCP pool Is there a way to set the database timeout in dbcp??? I have a database which I have no control under its timeout. I used a pool api that allowed me to set the database timeout, but as I want to move to DBCP, is there a way to set this??? -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP pool
I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP pool
How do I specify the test query as context param? There is nothing in the JDBC configuration of DBCP in tomcat 5 docs. BTW, I found some typos erros, must I create a bug, or may I put it here? other question: May I mix the Resource and ResourceParams tags?? I'm asking this because I have to configure 2 connection in some apps, so I must put a Resource and a ResourceParams tag sequencially for each connection I want to configure?? Thanks for your response Emerson Mike Curwen wrote: I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP pool
I'm not an expert, but I suspect that the resource config parameters will act like javabean setters. So you should be able to specify something like: parameter namevalidationQuery/name valueSELECT 1/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 4:30 PM To: Tomcat Users List Subject: Re: DBCP pool How do I specify the test query as context param? There is nothing in the JDBC configuration of DBCP in tomcat 5 docs. BTW, I found some typos erros, must I create a bug, or may I put it here? other question: May I mix the Resource and ResourceParams tags?? I'm asking this because I have to configure 2 connection in some apps, so I must put a Resource and a ResourceParams tag sequencially for each connection I want to configure?? Thanks for your response Emerson Mike Curwen wrote: I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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: DBCP pool
What about this other question: May I mix the Resource and ResourceParams tags?? I'm asking this because I have to configure 2 connection in some apps, so I must put a Resource and a ResourceParams tag sequencially for each connection I want to configure?? Thanks for your response Emerson Mike Curwen wrote: I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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: DBCP pool
If testOnBorrow is not true, when is it tested? Mike Curwen wrote: I'm not an expert, but I suspect that the resource config parameters will act like javabean setters. So you should be able to specify something like: parameter namevalidationQuery/name valueSELECT 1/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 4:30 PM To: Tomcat Users List Subject: Re: DBCP pool How do I specify the test query as context param? There is nothing in the JDBC configuration of DBCP in tomcat 5 docs. BTW, I found some typos erros, must I create a bug, or may I put it here? other question: May I mix the Resource and ResourceParams tags?? I'm asking this because I have to configure 2 connection in some apps, so I must put a Resource and a ResourceParams tag sequencially for each connection I want to configure?? Thanks for your response Emerson Mike Curwen wrote: I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP pool
http://jakarta.apache.org/commons/dbcp/configuration.html -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 4:40 PM To: Tomcat Users List Subject: Re: DBCP pool If testOnBorrow is not true, when is it tested? Mike Curwen wrote: I'm not an expert, but I suspect that the resource config parameters will act like javabean setters. So you should be able to specify something like: parameter namevalidationQuery/name valueSELECT 1/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 4:30 PM To: Tomcat Users List Subject: Re: DBCP pool How do I specify the test query as context param? There is nothing in the JDBC configuration of DBCP in tomcat 5 docs. BTW, I found some typos erros, must I create a bug, or may I put it here? other question: May I mix the Resource and ResourceParams tags?? I'm asking this because I have to configure 2 connection in some apps, so I must put a Resource and a ResourceParams tag sequencially for each connection I want to configure?? Thanks for your response Emerson Mike Curwen wrote: I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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: DBCP pool
Resource name=jdbc/TestDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/TestDB ONE SET OF PARAMETER TAGS /ResourceParams Resource name=jdbc/AnotherDB auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/AnotherDB SECOND SET OF PARAMETER TAGS /ResourceParams That's the way I'd do it. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 4:40 PM To: Tomcat Users List Subject: Re: DBCP pool What about this other question: May I mix the Resource and ResourceParams tags?? I'm asking this because I have to configure 2 connection in some apps, so I must put a Resource and a ResourceParams tag sequencially for each connection I want to configure?? Thanks for your response Emerson Mike Curwen wrote: I think the way to do this with DBCP is to specify a test query. The pool would then run this query (like SELECT 1) before giving out the connection. If it failed (and if it's because the connection is closed), it will null this connection in the pool, open a new connection, and retest it, and then give this one out. If any of that is factually wrong, someone will be sure to jump in and correct me. -Original Message- From: Emerson Cargnin [mailto:[EMAIL PROTECTED] Sent: Thursday, July 15, 2004 3:03 PM To: Tomcat Users List Subject: Re: DBCP pool none of them, I mean the timeout set in database, the maximum life time for an connection. This is used when you have a database that has a given timeout, let's say, 10 minutes, so you can't have this connection opened for more than 10 minutes, what would case an error due to an timeouted connection. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Emerson Cargnin Analista de Sistemas - Gerente Regional - Tubarão Setor de Desenvolvimento de Sistemas - TRE-SC tel : (048) - 251-3700 - Ramal 3181 - 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: DBCP with JDBC driver in WEB-INF/lib
I don't think you can. The classloader that supports the jars in common/lib can't see the jars in your webapp. It's one of those cases where your webapp's classloader can see the jars at the tomcat level, but not the other way around. I think your stuck with either getting the provider to update their driver or rewriting your code to the older driver they are running. --David Steven J. Owens wrote: Hi all, I'm using tomcat with DBCP for connection pooling, on a hosted server. My hosting provider is using an older driver that doesn't support some JDBC 3.0 features I'd like. When I asked them about upgrading, they told me I could just stick the jar file for the more up-to-date driver in WEB-INF/lib and use that. What I'm wondering is, how do I tell DBCP to use the WEB-INF/lib jar file? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP with JDBC driver in WEB-INF/lib
On Sun, Jul 11, 2004 at 01:49:24AM -0400, Steven J. Owens wrote: : My hosting provider is using an older driver that doesn't support : some JDBC 3.0 features I'd like. : : When I asked them about upgrading, they told me I could just stick : the jar file for the more up-to-date driver in WEB-INF/lib and use that. : : What I'm wondering is, how do I tell DBCP to use the WEB-INF/lib : jar file? I don't think this is possible -- IIRC Tomcat looks for DB drivers in common/lib because that's handled by the container's classloader, not the per-context classloader. (This makes sense: think of where pooling is handled.) Review the Tomcat docs for DBCP. You may find some ammo to hand back to your admins. It may not get them to change their minds, but at least they would stop telling people to do something that won't work ;) -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: DBCP pooling error
Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: Web.xml resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Check this link out: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples -howto.html -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:46 PM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Well...good news is were getting a new error: Name paso2d is not bound in this Context Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: DataSource ds = (DataSource) initContext.lookup(java:comp/env/jdbc/paso2d); -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 11:45 AM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Shouldn't need the Factory Tyrex stuff for the 4.12 version but didn't work anyway...but here is what the logs are saying in Catalina.out: Cannot load JDBC driver class 'null' java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:523) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja va:312) at org.apache.jsp.JDBCTest_jsp._jspService(JDBCTest_jsp.java:57) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator Base.java:471) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(St Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757
RE: DBCP pooling error
Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: Web.xml resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Check this link out: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples -howto.html -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:46 PM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Well...good news is were getting a new error: Name paso2d is not bound in this Context Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: DataSource ds = (DataSource) initContext.lookup(java:comp/env/jdbc/paso2d); -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 11:45 AM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Shouldn't need the Factory Tyrex stuff for the 4.12 version but didn't work anyway...but here is what the logs are saying in Catalina.out: Cannot load JDBC driver class 'null' java.lang.NullPointerException at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:115) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource .java:523) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.ja va:312) at org.apache.jsp.JDBCTest_jsp._jspService(JDBCTest_jsp.java:57) at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:136) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.ja va:204) at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289) at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica tionFilterChain.java:247) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt erChain.java:193) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv e.java:260) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv e.java:191) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:643) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authenticator Base.java:471) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i nvokeNext(StandardPipeline.java:641) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:4 80) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995) at org.apache.catalina.core.StandardContext.invoke(St Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP pooling error
Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valueeporaadm/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp html head %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % /head body h1JDBC JNDI Resource Test/h1 % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % table width='600' border='1' tr th align='left'bems_id/th th align='left'last_name/th /tr % while (rset.next()) { % trtd %= rset.getString(1) %/td td %= rset.getString(2) %/td /tr % } conn.close(); initContext.close(); % /table /body /html Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: Web.xml resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Check this link out: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-example s -howto.html -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:46 PM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Well...good news is were getting a new error: Name paso2d is not bound in this Context Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: DataSource ds = (DataSource) initContext.lookup(java:comp/env/jdbc/paso2d); -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 11:45 AM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Shouldn't
RE: DBCP pooling error
Hmm, the only thing might be that you can leave out tracks_adm from valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value And if you do the lookup though: Context ctx = new InitialContext(); Object datasource = ctx.lookup(java:/comp/env/jdbc/paso2d); ? Greetz Hans ps and part of your server.xml was missing, but i assume you didn't paste all of it (the closing tags etc) At 02:22 PM 6/17/2004 -0500, you wrote: Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valueeporaadm/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % JDBC JNDI Resource Test % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % bems_id last_name % while (rset.next()) { % %= rset.getString(1) % %= rset.getString(2) % % } conn.close(); initContext.close(); % Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: Web.xml resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Check this link out: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-example s -howto.html -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:46 PM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Well...good news is were getting a new error: Name paso2d is not bound in this Context Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: DataSource ds = (DataSource) initContext.lookup(java:comp/env/jdbc/paso2d); -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 11:45 AM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Shouldn't need the Factory Tyrex stuff
RE: DBCP pooling error
I'll check those things...how is the location in the Server.xml? Is it in the right place? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:39 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hmm, the only thing might be that you can leave out tracks_adm from valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value And if you do the lookup though: Context ctx = new InitialContext(); Object datasource = ctx.lookup(java:/comp/env/jdbc/paso2d); ? Greetz Hans ps and part of your server.xml was missing, but i assume you didn't paste all of it (the closing tags etc) At 02:22 PM 6/17/2004 -0500, you wrote: Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valueeporaadm/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % JDBC JNDI Resource Test % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % bems_id last_name % while (rset.next()) { % %= rset.getString(1) % %= rset.getString(2) % % } conn.close(); initContext.close(); % Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: Web.xml resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Check this link out: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-example s -howto.html -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:46 PM To: [EMAIL PROTECTED] Subject: RE: DBCP pooling error Well...good news is were getting a new error: Name paso2d is not bound in this Context Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From
RE: DBCP pooling error
Hi, seems to be ok, i do seem to have an additional nesting, engine-host-context but I do not know if it matters. If you do a Class.forName from your jsp page, can you load the class ok? I'm grasping at straws here as well ;-) grtz Hans At 02:41 PM 6/17/2004 -0500, you wrote: I'll check those things...how is the location in the Server.xml? Is it in the right place? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:39 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hmm, the only thing might be that you can leave out tracks_adm from valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value And if you do the lookup though: Context ctx = new InitialContext(); Object datasource = ctx.lookup(java:/comp/env/jdbc/paso2d); ? Greetz Hans ps and part of your server.xml was missing, but i assume you didn't paste all of it (the closing tags etc) At 02:22 PM 6/17/2004 -0500, you wrote: Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valueeporaadm/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % JDBC JNDI Resource Test % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % bems_id last_name % while (rset.next()) { % %= rset.getString(1) % %= rset.getString(2) % % } conn.close(); initContext.close(); % Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2:52 PM To: Bliesner, Christopher P Subject: RE: DBCP pooling error Try this: Web.xml resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Check this link out: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-example s -howto.html -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 12:46 PM To: [EMAIL
RE: DBCP pooling error
Well, I'm getting some new errors at least.. org.apache.jasper.JasperException: Unable to compile class for JSP An error occurred at line: 17 in the jsp file: /jsp/JDBCTest.jsp Generated servlet error: [javac] Compiling 1 source file /usr/local/jakarta-tomcat-4.1.12/work/Standalone/epdata02.elps.bna.boein g.com/examples/jsp/JDBCTest_jsp.java:58: cannot resolve symbol symbol : class Datasource location: class org.apache.jsp.JDBCTest_jsp Datasource ds = (Datasource)initCtx.lookup(java:/comp/env/jdbc/paso2d); ^ An error occurred at line: 17 in the jsp file: /jsp/JDBCTest.jsp Generated servlet error: /usr/local/jakarta-tomcat-4.1.12/work/Standalone/epdata02.elps.bna.boein g.com/examples/jsp/JDBCTest_jsp.java:58: cannot resolve symbol symbol : class Datasource location: class org.apache.jsp.JDBCTest_jsp Datasource ds = (Datasource)initCtx.lookup(java:/comp/env/jdbc/paso2d); ^ 2 errors Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:39 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hmm, the only thing might be that you can leave out tracks_adm from valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value And if you do the lookup though: Context ctx = new InitialContext(); Object datasource = ctx.lookup(java:/comp/env/jdbc/paso2d); ? Greetz Hans ps and part of your server.xml was missing, but i assume you didn't paste all of it (the closing tags etc) At 02:22 PM 6/17/2004 -0500, you wrote: Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % JDBC JNDI Resource Test % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % bems_id last_name % while (rset.next()) { % %= rset.getString(1) % %= rset.getString(2) % % } conn.close(); initContext.close(); % Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message
RE: DBCP pooling error
This has been fixed! Thx for the help! Turns out the problem is the classpath! DBCP doesn't need one!! It gets confused! I had everything else right... Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:55 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, seems to be ok, i do seem to have an additional nesting, engine-host-context but I do not know if it matters. If you do a Class.forName from your jsp page, can you load the class ok? I'm grasping at straws here as well ;-) grtz Hans At 02:41 PM 6/17/2004 -0500, you wrote: I'll check those things...how is the location in the Server.xml? Is it in the right place? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:39 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hmm, the only thing might be that you can leave out tracks_adm from valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value And if you do the lookup though: Context ctx = new InitialContext(); Object datasource = ctx.lookup(java:/comp/env/jdbc/paso2d); ? Greetz Hans ps and part of your server.xml was missing, but i assume you didn't paste all of it (the closing tags etc) At 02:22 PM 6/17/2004 -0500, you wrote: Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valueeporaadm/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % JDBC JNDI Resource Test % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % bems_id last_name % while (rset.next()) { % %= rset.getString(1) % %= rset.getString(2) % % } conn.close(); initContext.close(); % Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 2
RE: DBCP pooling error
My mistake--It wasn't the CLASSPATH that was the problem but a semicolon that I had in my select statement. That was causing the dBCP to fail. Thx all for the help! :) Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:55 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, seems to be ok, i do seem to have an additional nesting, engine-host-context but I do not know if it matters. If you do a Class.forName from your jsp page, can you load the class ok? I'm grasping at straws here as well ;-) grtz Hans At 02:41 PM 6/17/2004 -0500, you wrote: I'll check those things...how is the location in the Server.xml? Is it in the right place? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:39 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hmm, the only thing might be that you can leave out tracks_adm from valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value And if you do the lookup though: Context ctx = new InitialContext(); Object datasource = ctx.lookup(java:/comp/env/jdbc/paso2d); ? Greetz Hans ps and part of your server.xml was missing, but i assume you didn't paste all of it (the closing tags etc) At 02:22 PM 6/17/2004 -0500, you wrote: Hi Hans, yes seems like I've got all the I's dotted and the t's crossed...but still can't get the damn thing to load...I've got all the Jars in the tomcat/common/lib and in the classpath and the following are my 3 files. Let me know if you see anything I may have missed: Server.xml: !-- Define the top level container in our container hierarchy -- Engine name=Standalone defaultHost=epdata02.elps.bna.boeing.com debug=0 Context path=/examples docBase=examples debug=5 reloadable=true crossContext=true Logger className=org.apache.catalina.logger.FileLogger prefix=localhost_DBTest_log. suffix=.txt timestamp=true/ Resource name=jdbc/paso2d auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/paso2d parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:paso2d/value /parameter parameter nameusername/name valuetracks_adm/value /parameter parameter namepassword/name valueeporaadm/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value3/value Web.xml: resource-ref res-ref-namejdbc/paso2d/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Java code: # cat JDBCTest.jsp %@ page errorPage=errorpg.jsp import=java.sql.*, javax.sql.*, oracle.jdbc.*, java.io.*, javax.naming.InitialContext, javax.servlet.*, javax.servlet.http.*, java.util.*, javax.naming.Context % JDBC JNDI Resource Test % Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource) envContext.lookup(jdbc/paso2d); Connection conn = ds.getConnection(); Statement stmt = conn.createStatement(); ResultSet rset = stmt.executeQuery(select * from employee_info;); % bems_id last_name % while (rset.next()) { % %= rset.getString(1) % %= rset.getString(2) % % } conn.close(); initContext.close(); % Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: Hans Wichman [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 1:14 PM To: Tomcat Users List Subject: RE: DBCP pooling error Hi, there are 4 parts to this, a pool definition in your server.xml a resource ref in your web.xml a snippet of java code to get the datasource. a bunch of drivers (probably something like classes12.jar) Did you specify the first three of them and included the last one? grtz Hans At 11:23 AM 6/17/2004 -0500, you wrote: Still having trouble with getting the DBCP working with Oracle. I have seemingly followed the link below but I am still getting that NULL error below. Any ideas? Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday
re: DBCP pooling error
I'm running Tomcat 4.12 and trying to setup the DBCP. I followed everything outlined on the Jakarta/Tomcat site for setting up a DBCP for Oracle 8.1.7 but I'm still receiving the following message: Cannot load JDBC driver class 'null' Any help would be appreciated, thanks! Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757
RE: DBCP pooling error
I believe you need to move the Oracle classes12.jar and nls_charset12.jar files into your Tomcat\common\lib directory. -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 8:34 AM To: Tomcat Users List Subject: re: DBCP pooling error Importance: High I'm running Tomcat 4.12 and trying to setup the DBCP. I followed everything outlined on the Jakarta/Tomcat site for setting up a DBCP for Oracle 8.1.7 but I'm still receiving the following message: Cannot load JDBC driver class 'null' Any help would be appreciated, thanks! Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP pooling error
Hi David--I have the classes12.jar file there already but never heard of the nls_charset12.jar. What does that help with and where can I get a copy of that. Thx. Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 -Original Message- From: David Short [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 9:42 AM To: 'Tomcat Users List' Subject: RE: DBCP pooling error I believe you need to move the Oracle classes12.jar and nls_charset12.jar files into your Tomcat\common\lib directory. -Original Message- From: Bliesner, Christopher P [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 16, 2004 8:34 AM To: Tomcat Users List Subject: re: DBCP pooling error Importance: High I'm running Tomcat 4.12 and trying to setup the DBCP. I followed everything outlined on the Jakarta/Tomcat site for setting up a DBCP for Oracle 8.1.7 but I'm still receiving the following message: Cannot load JDBC driver class 'null' Any help would be appreciated, thanks! Chris Bliesner Lead Oracle DBA/Unix admin Wk Phone 915-834-1757 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP and removeAbandoned
Hi If I've understood things correctly removeAbandoned should enable recovery of 'lost' connections - ie your webApp dies without cleanly releaseing the Connection object, so having removeAbandoned on tells the container to keep an eye on things You've also got the timeout set to 60 (secs ??) - did you wait this long when you were checking Obviously when you stop Tomcat, the whole JRE gets shutdown so what you've seen there is correct Eric Prévost [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I'm using Tomcat 5.0.18 on Linux. My database server is Microsoft SQL Server 2000. I'm using Microsoft's JDBC driver. This is my data source definition in server.xml: Resource name=jdbc/intranet type=javax.sql.DataSource/ ResourceParams name=jdbc/intranet parameter namevalidationQuery/name valueselect getdate()/value /parameter parameter namemaxWait/name value5000/value /parameter parameter namemaxActive/name value50/value /parameter parameter namepassword/name valuemyPassword/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://myserver;DatabaseName=intranet/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter namemaxIdle/name value30/value /parameter parameter nameusername/name valueMyUsername/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter /ResourceParams When I stress-test my application with JMeter, I can see over 80 connections on my database server, and they are not released until I stop tomcat... Is removeAbandoned parameter not supposed to take care of these connections??? Thank you Eric Prévost - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP and removeAbandoned
I did my tests yesterday, and the connections was still alive this morning... I also tested 5 seconds before. SMaric [EMAIL PROTECTED] wrote:Hi If I've understood things correctly removeAbandoned should enable recovery of 'lost' connections - ie your webApp dies without cleanly releaseing the Connection object, so having removeAbandoned on tells the container to keep an eye on things You've also got the timeout set to 60 (secs ??) - did you wait this long when you were checking Obviously when you stop Tomcat, the whole JRE gets shutdown so what you've seen there is correct Eric Prévost wrote in message news:[EMAIL PROTECTED] Hi, I'm using Tomcat 5.0.18 on Linux. My database server is Microsoft SQL Server 2000. I'm using Microsoft's JDBC driver. This is my data source definition in server.xml: validationQuery select getdate() maxWait 5000 maxActive 50 password myPassword url jdbc:microsoft:sqlserver://myserver;DatabaseName=intranet driverClassName com.microsoft.jdbc.sqlserver.SQLServerDriver maxIdle 30 username MyUsername removeAbandoned true removeAbandonedTimeout 60 factory org.apache.commons.dbcp.BasicDataSourceFactory When I stress-test my application with JMeter, I can see over 80 connections on my database server, and they are not released until I stop tomcat... Is removeAbandoned parameter not supposed to take care of these connections??? Thank you Eric Prévost - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage.
Re: DBCP and removeAbandoned
Hi! Eric Prévost wrote: I'm using Tomcat 5.0.18 on Linux. My database server is Microsoft SQL Server 2000. I'm using Microsoft's JDBC driver. When I stress-test my application with JMeter, I can see over 80 connections on my database server, and they are not released until I stop tomcat... Is removeAbandoned parameter not supposed to take care of these connections??? I am not entirely sure here, so please correct me, if I'm wrong, but... you are using dbcp, right? So, isn't the pool _supposed_ to reuse open connections instead of closing them and reopening anew for each request? I think what you should do is choose a reasonable max number of connections and then stress-test while look for a dbcp exception indicating that no new connection could be acquired. If you get one, either removeabandoned is not working properly, of (more likely) your application keeps a hold on connections that therefor are not concidered abandoned. If you don't get an exception, you can be quite sure you will never see more connections than you specified. HTH Phil - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP and removeAbandoned
When you say 'the connections was still alive this morning' How are you testing for connections being abandoned Also your maxActive = 50//doesn't this mean you shouldn't get more tahn 50 connections from the pool if this is true ( working) then HOW do you know that the 80 connections are from this Pool ??? Are you are the only point of connection to the DB Eric Prévost [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I did my tests yesterday, and the connections was still alive this morning... I also tested 5 seconds before. SMaric [EMAIL PROTECTED] wrote:Hi If I've understood things correctly removeAbandoned should enable recovery of 'lost' connections - ie your webApp dies without cleanly releaseing the Connection object, so having removeAbandoned on tells the container to keep an eye on things You've also got the timeout set to 60 (secs ??) - did you wait this long when you were checking Obviously when you stop Tomcat, the whole JRE gets shutdown so what you've seen there is correct Eric Prévost wrote in message news:[EMAIL PROTECTED] Hi, I'm using Tomcat 5.0.18 on Linux. My database server is Microsoft SQL Server 2000. I'm using Microsoft's JDBC driver. This is my data source definition in server.xml: validationQuery select getdate() maxWait 5000 maxActive 50 password myPassword url jdbc:microsoft:sqlserver://myserver;DatabaseName=intranet driverClassName com.microsoft.jdbc.sqlserver.SQLServerDriver maxIdle 30 username MyUsername removeAbandoned true removeAbandonedTimeout 60 factory org.apache.commons.dbcp.BasicDataSourceFactory When I stress-test my application with JMeter, I can see over 80 connections on my database server, and they are not released until I stop tomcat... Is removeAbandoned parameter not supposed to take care of these connections??? Thank you Eric Prévost - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: DBCP and removeAbandoned
There is only one application on this tomcat server... It's easy to identify these connections on SQL server. Also, there is no explicit database connection in the application code: it all pass through JNDI. I also tried to increase my maxActive setting to 100. It didn't change anything. I set logAbandoned to true. I never see anything related to dbcp in my logs except this, in calatina.out: AbandonedObjectPool is used ([EMAIL PROTECTED]) LogAbandoned: true RemoveAbandoned: true RemoveAbandonedTimeout: 10 What can it be? Maybe someone stored a resultset in session? SMaric [EMAIL PROTECTED] wrote: When you say 'the connections was still alive this morning' How are you testing for connections being abandoned Also your maxActive = 50 // doesn't this mean you shouldn't get more tahn 50 connections from the pool if this is true ( working) then HOW do you know that the 80 connections are from this Pool ??? Are you are the only point of connection to the DB Eric Prévost wrote in message news:[EMAIL PROTECTED] I did my tests yesterday, and the connections was still alive this morning... I also tested 5 seconds before. SMaric wrote:Hi If I've understood things correctly removeAbandoned should enable recovery of 'lost' connections - ie your webApp dies without cleanly releaseing the Connection object, so having removeAbandoned on tells the container to keep an eye on things You've also got the timeout set to 60 (secs ??) - did you wait this long when you were checking Obviously when you stop Tomcat, the whole JRE gets shutdown so what you've seen there is correct Eric Prévost wrote in message news:[EMAIL PROTECTED] Hi, I'm using Tomcat 5.0.18 on Linux. My database server is Microsoft SQL Server 2000. I'm using Microsoft's JDBC driver. This is my data source definition in server.xml: validationQuery select getdate() maxWait 5000 maxActive 50 password myPassword url jdbc:microsoft:sqlserver://myserver;DatabaseName=intranet driverClassName com.microsoft.jdbc.sqlserver.SQLServerDriver maxIdle 30 username MyUsername removeAbandoned true removeAbandonedTimeout 60 factory org.apache.commons.dbcp.BasicDataSourceFactory When I stress-test my application with JMeter, I can see over 80 connections on my database server, and they are not released until I stop tomcat... Is removeAbandoned parameter not supposed to take care of these connections??? Thank you Eric Prévost - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - Lèche-vitrine ou lèche-écran ? Yahoo! Magasinage.
Re: dbcp doesn't stacktrace
Hi Marten, Marten Lehmann wrote: to test dbcp's stacktrace functionality, I didn't close the databases connection after use. But although I set the abondedTimeout to 60, the connections are never returned, they are still open and I don't see a stacktrace, too. You only get stack traces when you ultimaltly run out of connections, if I remember well. Perhaps you should set max connextions attribute to a low, test-only value to verify the correct behaviour. Regards, -Florian - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP and reloading war file
Hey Cliff, I have a similar problem with Tomcat 4.1., but I am using the same connector and the same SDK as you. I am not sure if I can help, because I have not yet solved it on my end. However, I have been trying to work with the catalina.policy file to grant rights to Tomcat to startup the MySQL connection. grant codeBase file:/usr/local/mysql/- { permission java.security.AllPermission; }; // Connect to MySQL permission java.net.SocketPermission localhost:3306, read,connect,resolve,listen; permission java.util.PropertyPermission file.encoding, read; I have been trying the above modifications to the catalina.policy file, but is not working. Please reply to the group when you solve in ( and I am using 4.1 not 5.0 ) Brent -Original Message- From: Cliff Willsher [mailto:[EMAIL PROTECTED] Sent: Thursday, November 13, 2003 11:32 PM To: [EMAIL PROTECTED] Subject: DBCP and reloading war file Hi, I have configured my server and web-app to use a DBCP datasource. All works well after the server has been started. If I then replace the war file with an updated version, the server notices the change and redeploys the war file and loads the updated application, however the JNDI datasource now fails. A datasource is returned from the lookup but the driver name attribute is null hence the consequent access fails. Restarting the server make things work normally again. I am using Tomcat 5.0.14 with Java SDK 1.4.2_02 with MySQL connector version 3.0.9 I believe I have eliminated any application errors by going back to the example from the Tomcat docs and this displays the same behaviour so I guess I have something configured badly. I will post all the configuration info if needed. Any help appreciated. Cliff - 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]
Réf. : RE: Réf. : RE: dbcp pool size
Not sure you won't get it. Because I'm getting it in any way. Specifiying it or not. This parameter is implicit. Meissa Sakho NATEXIS ASSET MANAGEMENT Direction de l'organisation Tel. : 01 58 19 45 71 http://www.assetmanagement.natexis.fr Shapira, Yoav [EMAIL PROTECTED] 10/11/2003 15:47 Veuillez répondre à Tomcat Users List Pour : Tomcat Users List [EMAIL PROTECTED] cc : Objet : RE: Réf. : RE: dbcp pool size Howdy, This is OK, and hopefully you won't get the same error. Why don't you test it out? ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Kenneth [mailto:[EMAIL PROTECTED] Sent: Saturday, November 08, 2003 7:43 AM To: Tomcat Users List Subject: Re: Réf. : RE: dbcp pool size Sorry, but I'm quite new to this, and I'd like to know if I'm doing it OK. I'm using dbcp with mySQL and I always specify this parameter: parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter Is this OK? Will I get the same error Meissa does? Thanks. Ken - 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] L'integrite de ce message n'etant pas assuree sur internet, Natexis Banques Populaires ne peut etre tenu responsable de son contenu. Toute utilisation ou diffusion non autorisee est interdite. Si vous n'etes pas destinataire de ce message, merci de le detruire et d'avertir l'expediteur. The integrity of this message cannot be guaranteed on the Internet. Natexis Banques Populaires can not therefore be considered responsible for the contents.Any unauthorized use or dissemination is prohibited. If you are not the intended recipient of this message, then please delete it and notify the sender.
RE: DBCP could not obtain an idle db connection, pool exhausted
Maybe our problem here is the DBCP itself, i´m trying to test Evermind´s Oracle DBCP. I´ll see if the same happen. -- De: Galbayar[SMTP:[EMAIL PROTECTED] Responder:Tomcat Users List Enviada: terça-feira, 11 de novembro de 2003 3:31 Para: Tomcat Users List Assunto: RE: DBCP could not obtain an idle db connection, pool exhausted Yes I have closed ResultSet, Statement and Connection Have you tried to close ResultSet, Statement and Connection after each use? -Original Message- From: Galbayar [mailto:[EMAIL PROTECTED] Sent: November 10, 2003 4:50 AM To: Tomcat Users List Subject: DBCP could not obtain an idle db connection, pool exhausted How to solve this problem? I'm using Tomcat 4.1.27 J2SDK (build 1.4.1_03-b02 Tyrex 1.0 Commons DBCP 1.1 MySQL ConnectorJ version 3.0.8 My server.xml configuration Context ... Resource name=jdbc/sss auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sss parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueusername/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namedriverClassName/name valueocom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/sss?autoReconnect=true/value /parameter /ResourceParams /Context Galbayar. D Senior software engineer Mobile Business Development Business Development Division MobiCom Corporation Peace Avenue 3/1 P.O Box 20A Ulaanbaatar 210620 Mongolia - 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: Réf. : RE: dbcp pool size
Howdy, This is OK, and hopefully you won't get the same error. Why don't you test it out? ;) Yoav Shapira Millennium ChemInformatics -Original Message- From: Kenneth [mailto:[EMAIL PROTECTED] Sent: Saturday, November 08, 2003 7:43 AM To: Tomcat Users List Subject: Re: Réf. : RE: dbcp pool size Sorry, but I'm quite new to this, and I'd like to know if I'm doing it OK. I'm using dbcp with mySQL and I always specify this parameter: parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter Is this OK? Will I get the same error Meissa does? Thanks. Ken - 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: DBCP could not obtain an idle db connection, pool exhausted
Have you tried to close ResultSet, Statement and Connection after each use? -Original Message- From: Galbayar [mailto:[EMAIL PROTECTED] Sent: November 10, 2003 4:50 AM To: Tomcat Users List Subject: DBCP could not obtain an idle db connection, pool exhausted How to solve this problem? I'm using Tomcat 4.1.27 J2SDK (build 1.4.1_03-b02 Tyrex 1.0 Commons DBCP 1.1 MySQL ConnectorJ version 3.0.8 My server.xml configuration Context ... Resource name=jdbc/sss auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sss parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueusername/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namedriverClassName/name valueocom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/sss?autoReconnect=true/value /parameter /ResourceParams /Context Galbayar. D Senior software engineer Mobile Business Development Business Development Division MobiCom Corporation Peace Avenue 3/1 P.O Box 20A Ulaanbaatar 210620 Mongolia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: DBCP could not obtain an idle db connection, pool exhausted
Hi buddy, I also have same problem with same configuration with j2sdk-1_4_1_02. I close ResultSet, Statement and Connection afer use but after 3, 4 times continuous connection, server connection fail during transaction message appear. When I restart Tomcat, it works again. Than Win Project Manager Raynet IT Co.Ltd Myanmar Have you tried to close ResultSet, Statement and Connection after each use? -Original Message- From: Galbayar [mailto:[EMAIL PROTECTED] Sent: November 10, 2003 4:50 AM To: Tomcat Users List Subject: DBCP could not obtain an idle db connection, pool exhausted How to solve this problem? I'm using Tomcat 4.1.27 J2SDK (build 1.4.1_03-b02 Tyrex 1.0 Commons DBCP 1.1 MySQL ConnectorJ version 3.0.8 My server.xml configuration Context ... Resource name=jdbc/sss auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sss parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueusername/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namedriverClassName/name valueocom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/sss?autoReconnect=true/value /parameter /ResourceParams /Context Galbayar. D Senior software engineer Mobile Business Development Business Development Division MobiCom Corporation Peace Avenue 3/1 P.O Box 20A Ulaanbaatar 210620 Mongolia - 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: DBCP could not obtain an idle db connection, pool exhausted
Yes I have closed ResultSet, Statement and Connection Have you tried to close ResultSet, Statement and Connection after each use? -Original Message- From: Galbayar [mailto:[EMAIL PROTECTED] Sent: November 10, 2003 4:50 AM To: Tomcat Users List Subject: DBCP could not obtain an idle db connection, pool exhausted How to solve this problem? I'm using Tomcat 4.1.27 J2SDK (build 1.4.1_03-b02 Tyrex 1.0 Commons DBCP 1.1 MySQL ConnectorJ version 3.0.8 My server.xml configuration Context ... Resource name=jdbc/sss auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/sss parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value20/value /parameter parameter namemaxWait/name value1/value /parameter parameter nameusername/name valueusername/value /parameter parameter namepassword/name valuepassword/value /parameter parameter namedriverClassName/name valueocom.mysql.jdbc.Driver/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/sss?autoReconnect=true/value /parameter /ResourceParams /Context Galbayar. D Senior software engineer Mobile Business Development Business Development Division MobiCom Corporation Peace Avenue 3/1 P.O Box 20A Ulaanbaatar 210620 Mongolia - 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: Réf. : RE: dbcp pool size
Sorry, but I'm quite new to this, and I'd like to know if I'm doing it OK. I'm using dbcp with mySQL and I always specify this parameter: parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter Is this OK? Will I get the same error Meissa does? Thanks. Ken - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]