Re: connection pooling oracle
Brian, What is it that you're looking to accomplish with that cast? It makes it hard for others to respond with suggestions when they don't know what your criteria are. Also, how does it fail when you try it (ie ClassCastException)? Personally, I haven't run into any issues, but I just stick with the generic result set. Give a few more details so that people can understand your issue. Cheers, PST On 6/6/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am attempting to set up connection pooling in tomcat 5.0.28 using oracle 10g. I am able to successfully use org.apache.commons.dbcp.BasicDataSourceFactory as long as my rs.executeQuery() is not cast to OracleResultSet. I have seen a few threads on this topic but I can't seem to find an implementation that I can actually get to work. Does anyone have any helpful info that can guide me in the right direction? Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling basic help please
Krishnakant Mane wrote: hello, I refered to the docs in tomcat 5 for connection pooling. the document is pritty comprehencive and I understood the server.xml part of it. but now I want to know how exactly can I use a connection from the pool in my servlet. the example in tomcat documentation is on a jsp based applicatio. but I don't understand how I use a pooled connection in a servlet. You use a pooled connection in a simillar manner to a driver managed connection, except that you look up a resource (JNDI in this case). In your servlet just look up the resource. should I initialise the connection in the Init method? how and when should I close the connection? You should close the connection immediately when you are done with it. Best not to pass references of them around. You would close them as a you would in a driver managed connection, that is Connection.close() ; and wat entries in the web.xml file will effect connection pooling? Please help it is really urgent. thanks Krishnakant. Send instant messages to your online friends http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling basic help please
On Sat, Apr 02, 2005 at 08:21:24PM +0100, Krishnakant Mane wrote: : the example in tomcat documentation is on a jsp based : applicatio. but I don't understand how I use a pooled : connection in a servlet. : [snip] : should I initialise the connection in the Init method? : how and when should I close the connection? 1/ please post a *new* message when writing to the list. Replying to an old (unrelated) message confuses thread-aware mailers, which makes your question harder to find (and thus answer). 2/ I don't have the JSP sample in front of me, but there should be plenty of examples of using a DataSource out on the web. A little Googling should turn them up. The short version is: - perform a JNDI lookup to find the DataSource - pull a Connection from that data source - use the Connection to talk with a databse - call close() on that connection You should hold on to the Connection for as short a period of time as possible. This is easier to manage if all of the database calls are done from a particular set of objects (a data layer). Having all of your components do the JNDI lookup, etc can get messy and tough to maintain. Isolate all of your data calls to a separate object (or set of objects). You could initialize these objects in a ServletContextListener and either store them under Application scope or in a singleton such that they would be globally available. -QM -- software -- http://www.brandxdev.net/ tech news -- http://www.RoarNetworX.com/ code scan -- http://www.JxRef.org/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling confusion help needed
Hi, Please follow the directions by user rmorriso on the following link. It should work fine. http://forums.devshed.com/archive/t-120081 On Fri, 25 Mar 2005 19:11:15 + (GMT), Krishnakant Mane [EMAIL PROTECTED] wrote: hello all, im going to put a web application in java servlets with tomcat 5 on a production ready server for real time use. I am thinking of using connection pooling but I am a bit confused. I have initialised all my connections in the servlet's init method and closed them in distroy method. so these connections are not closed untill the server is turned off. now how will the connection pooling track these un closed connections? and I will like some one to make me understand with an example of how to implement connection pooling using mysql jdbc. I will be happy if some one gives a complete example including how to define context and where. and how to link it to a web application and how to call the connection from a pool. I have some rough idea but the tomcat docs really confused me. so please help me understand this connection pooling concept thanks Krishnakant. Send instant messages to your online friends http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling confusion help needed
Hi All the connection pool properties should be configured in server.xml. You dont have to initialize connections etc. in your init method. you just have to make sure you close your resultset and connection after you are done. Closing it will return it back to the pool. Here is one link from tomcat. Not sure if you took a look at it already http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations Pandu From: Krishnakant Mane [EMAIL PROTECTED] Reply-To: Tomcat Users List tomcat-user@jakarta.apache.org To: tomcat-user@jakarta.apache.org Subject: connection pooling confusion help needed Date: Fri, 25 Mar 2005 19:11:15 + (GMT) hello all, im going to put a web application in java servlets with tomcat 5 on a production ready server for real time use. I am thinking of using connection pooling but I am a bit confused. I have initialised all my connections in the servlet's init method and closed them in distroy method. so these connections are not closed untill the server is turned off. now how will the connection pooling track these un closed connections? and I will like some one to make me understand with an example of how to implement connection pooling using mysql jdbc. I will be happy if some one gives a complete example including how to define context and where. and how to link it to a web application and how to call the connection from a pool. I have some rough idea but the tomcat docs really confused me. so please help me understand this connection pooling concept thanks Krishnakant. Send instant messages to your online friends http://uk.messenger.yahoo.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection pooling verse one connection per session
On Thu, Mar 10, 2005 at 10:31:41AM -0800, Mark Winslow wrote: : Hi, I have a sort of theoretical question. I'm : wondering about the pros and cons of using a one : connection per tomcat session strategy for connecting : to a Postgresql server rather than connection pooling. The great benefit of pooling is that objects that aren't being (actively) used by one person/login/etc can be used by another. Put another way, the Connection objects aren't specific to a user, so there's no need to treat them as such. (If you've done any EJB, think of Stateless vs Stateful Session Beans.) You say your users are logged into your app all day; but are they constantly streaming data from the minute they login to the minute they logout? If not, then holding open the DB connection for them isn't helping much. (I'd hesitate to say it's doing harm or anything bad, just that it's not helping.) For this same reason, pooling also helps in scalability: when a Connection is idle (not being used by anyone), someone else can use it. : 1. Can cache prepared statements, something that is : more problematic to do with a generic connection pool. True; but have you seen a significant performance gain due to prepared statement caching? : 2. Have better control of connection releases via the : finalize() method in a session helper class that : contains the one single connection. I'm not sure I understand this. If your app is written such that data-access code fetches a Connection as needed, then returns it to the pool when it's done (Connection#close()), then what other control would you need? You realize, for a pooled connection, close() doesn't really shutdown the network connection. It just sends the Connection object back to the pool. : 3. Easier to code and implement than connection : pooling. Again, I don't understand this. Please explain. : 4. Potentially faster than connection pooling because : of only one connection open per session. Yes and no. The connection pool keeps the connection open all the time; so users who go through a pooled Connection object don't suffer any first time access hits. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection pooling verse one connection per session
OK, I see your points and they are well taken. A lot of my concern has to do with this http://jakarta.apache.org/tomcat/tomcat-5.5-doc/printer/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations There is one problem with connection pooling. A web application has to explicetely close ResultSet's, Statement's, and Connection's. So I don't close my result sets, etc. I have say 5 unique connection hits per page. Say the tomcat connection trash collector (set with removeAbandoned=true) runs every 1 minute. In one minute a user can easily hit 5 pages. That's 25 connections I've created and used for that user instead of just 1. Am I wrong about this? A lot of my confusion has to do with the details of how the underlying connection pool code works and how efficient it is. For instance can you assume that the overhead to create a Pooled Connection based an an already established connection is negligable? Releasing it the same thing? There are threading issues involved with connection pools. Do they create inefficient blocking conditions? I understand that there are problems associated with hanging onto a resource like a connection for extended periods of time. It's sort of a non-standard thing to do and maybe not worth any potential cpu/memory benefits. I think I'm probably trying to talk myself into droping my strategy and implementing connection pools. Thanks. --- QM [EMAIL PROTECTED] wrote: On Thu, Mar 10, 2005 at 10:31:41AM -0800, Mark Winslow wrote: : Hi, I have a sort of theoretical question. I'm : wondering about the pros and cons of using a one : connection per tomcat session strategy for connecting : to a Postgresql server rather than connection pooling. The great benefit of pooling is that objects that aren't being (actively) used by one person/login/etc can be used by another. Put another way, the Connection objects aren't specific to a user, so there's no need to treat them as such. (If you've done any EJB, think of Stateless vs Stateful Session Beans.) You say your users are logged into your app all day; but are they constantly streaming data from the minute they login to the minute they logout? If not, then holding open the DB connection for them isn't helping much. (I'd hesitate to say it's doing harm or anything bad, just that it's not helping.) For this same reason, pooling also helps in scalability: when a Connection is idle (not being used by anyone), someone else can use it. : 1. Can cache prepared statements, something that is : more problematic to do with a generic connection pool. True; but have you seen a significant performance gain due to prepared statement caching? : 2. Have better control of connection releases via the : finalize() method in a session helper class that : contains the one single connection. I'm not sure I understand this. If your app is written such that data-access code fetches a Connection as needed, then returns it to the pool when it's done (Connection#close()), then what other control would you need? You realize, for a pooled connection, close() doesn't really shutdown the network connection. It just sends the Connection object back to the pool. : 3. Easier to code and implement than connection : pooling. Again, I don't understand this. Please explain. : 4. Potentially faster than connection pooling because : of only one connection open per session. Yes and no. The connection pool keeps the connection open all the time; so users who go through a pooled Connection object don't suffer any first time access hits. -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] __ 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: Connection pooling verse one connection per session
On Thu, Mar 10, 2005 at 12:30:22PM -0800, Mark Winslow wrote: : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/printer/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations : : There is one problem with connection pooling. A web : application has to explicetely close ResultSet's, : Statement's, and Connection's. I'd hardly say that's a problem; that's just good coding practice. =) (example: When I'm done cooking, I should turn off the stove. Is that a problem with stoves, or just how stoves work?) Connection cleanup maintenance is straightforward: liberally sprinlke finally{} blocks around data access code. -and if that's abstracted out into a layer, and a separate set of objects, you shouldn't have to look in that many places to insert said finally{} blocks. : For instance can you assume that the : overhead to create a Pooled Connection based an an : already established connection is negligable? A pooled connection usually *is* an established connection. The idea of pooling (any sort of object pooling) is that the app (here, Tomcat) instantiates some number of said objects ahead of time, such that they're ready to use when needed. In some cases the objects are created on-demand but then kept around for future use. Pooled Connection objects are wrapped in another object (that also implements Connection) that intercepts close() calls. Instead of actually closing the connection, it returns the object to the pool. : There are threading : issues involved with connection pools. Such as...? As long as you treat a Connection as a hot potato -- hold on to it only as long as you need, then pitch it -- there should be no such threading issues. -and as long as you only fetch Connection objects from the DataSource, then you should never run into an issue where two sections of code get the same Connection. : It's sort of a non-standard thing to : do and maybe not worth any potential cpu/memory : benefits. I think I'm probably trying to talk myself : into droping my strategy and implementing connection : pools. For me, it's mostly a design issue. I design my apps such that I can switch the connection source (pooled, one-off, etc) and the code is none the wiser. It just knows, I get a Connection here, and I call close() on it when I'm done. Whether close() really terminates a network connection/DB session, or just returns an object to the pool, it doesn't matter... -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection pooling verse one connection per session
I'm still not entirely sure about this issue. The close/=null + finally blocks make for pretty ugly and error prone code if you ask me. Why doesn't the connection pool encapsulate closing anyway? Can't it encapsulate closing into the finalize() methods? Are there ordering issues for closing ResultSets, Statements, and Connections? Is infrequent garbage collection an issue? I'm asking about encapsulating into the finalize() methods because I don't like the asthetics of all the close/=null + finally statements. I believe they make for confusing and error prone code and would like a way to make my own encapsulating classes. --- QM [EMAIL PROTECTED] wrote: On Thu, Mar 10, 2005 at 12:30:22PM -0800, Mark Winslow wrote: : http://jakarta.apache.org/tomcat/tomcat-5.5-doc/printer/jndi-datasource-examples-howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations : : There is one problem with connection pooling. A web : application has to explicetely close ResultSet's, : Statement's, and Connection's. I'd hardly say that's a problem; that's just good coding practice. =) (example: When I'm done cooking, I should turn off the stove. Is that a problem with stoves, or just how stoves work?) __ 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: Connection pooling verse one connection per session
On Thu, Mar 10, 2005 at 10:31:41AM -0800, Mark Winslow wrote: 2. Have better control of connection releases via the finalize() method in a session helper class that contains the one single connection. I hope you meant finally clause rather than finalize() method. A finalize() method is only called when an object is garbage collected, which may not happen for a long, long time, if ever. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection pooling verse one connection per session
if ever.??? Is that really the case? My personal experience with Tomcat is that it does indeed have memory leak problems. In theory, shouldn't all objects created in a web user session eventually be garbage collected after the session ends? I in fact did mean the finalize() method. Is that the main reason not to encapsulate close() methodology there because of slow garbage collection? --- Caldarale, Charles R [EMAIL PROTECTED] wrote: On Thu, Mar 10, 2005 at 10:31:41AM -0800, Mark Winslow wrote: 2. Have better control of connection releases via the finalize() method in a session helper class that contains the one single connection. I hope you meant finally clause rather than finalize() method. A finalize() method is only called when an object is garbage collected, which may not happen for a long, long time, if ever. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] __ Do you Yahoo!? Yahoo! Sports - Sign up for Fantasy Baseball. http://baseball.fantasysports.yahoo.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection pooling verse one connection per session
From: Mark Winslow [mailto:[EMAIL PROTECTED] Subject: RE: Connection pooling verse one connection per session if ever.??? Is that really the case? My personal experience with Tomcat is that it does indeed have memory leak problems. Nearly all the memory leaks I've seen have been in the apps, frequently related to use of static variables to hold references to various session- or request-related items. The few that have actually been a Tomcat problem seem to get fixed fairly quickly. In theory, shouldn't all objects created in a web user session eventually be garbage collected after the session ends? The GC algorithms do not guarantee that any specific object will be collected. If minor (young generation) GCs are sufficient to keep the JVM running, a full (tenured generation) GC need not be performed. Objects in the tenured generation may never be collected and their finalize() methods may then never be called - the JVM may terminate first. I in fact did mean the finalize() method. Is that the main reason not to encapsulate close() methodology there because of slow garbage collection? I don't know that I'd characterize it as slow; the current GC algorithms try to do as little work as possible, so it may be a long time before the desired object gets collected. Since the point at which a finalize() method is called is so indeterminate, its usefulness is rather limited. (Any class with a finalizer method is also somewhat inefficient, since it disrupts GC - each such object must be collected twice - and it slows down object allocation, since each finalizable object has to be registered.) The try {}, catch {}, finally {} sequence is much more robust. - Chuck - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection pooling verse one connection per session
On Thu, Mar 10, 2005 at 01:52:02PM -0800, Mark Winslow wrote: : I'm still not entirely sure about this issue. The : close/=null + finally blocks make for pretty ugly and : error prone code if you ask me. Well, certainly no one's forcing you to code that way. It's just a fairly standard practice in Java webapps to pool DB connections and to use try/catch/finally blocks where appropriate. ;) : Why doesn't the connection pool encapsulate closing : anyway? It seems you're missing the point of the pool. Pooled connections remain open (logged in to the remote DB). The close() method on the Connection wrapper object puts the (underlying) Connection object back in the pool so others can use it. : Can't it encapsulate closing into the : finalize() methods? Maybe it does; but there's no guarantee finalizers will be called. Besides, do you want to wait for gc to run to free up connections? : Are there ordering issues for : closing ResultSets, Statements, and Connections? This is in the docs... I *think* closing a Connection closes all underlying Statement and ResultSet objects, but it's good form to just close them when you're done with them. : Is infrequent garbage collection an issue? If you're waiting for finalizers to do your cleanup work for you, yes. : I'm asking about encapsulating into the finalize() : methods because I don't like the asthetics of all the : close/=null + finally statements. Again, your call. -QM -- software -- http://www.brandxdev.net tech news -- http://www.RoarNetworX.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection pooling verse one connection per session
I don't know. I have one pure Tomcat (no Apache) server that all it does is serve about 300,000 static files per day. The memory usage grows and grows unexplicably. I run a cron job that restarts it everyday, which I had to started running with version 5.0.something or else it would eventually run out of memory and crash. I haven't seen what not restarting will do on 5.5 and the latest version of Java/Linux. I guess I'll try and see. I'm going to switch to using connection pools regardless. I really just had some questions about the standard way of releasing them and gc issues regarding them which have been answered by the nice people on this list. Thanks. Nearly all the memory leaks I've seen have been in the apps, frequently related to use of static variables to hold references to various session- or request-related items. The few that have actually been a Tomcat problem seem to get fixed fairly quickly. __ 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: Connection pooling verse one connection per session
Sorry, just had one other question about the use of static variables. Can this really be a problem? I thought that a static variable only gets a single copy per JVM/Context. For instance the use of static variables to define formats shouls save on memory usage shouldn't it? public class Helper { public static final DecimalFormat dFormat1 = new DecimalFormat(00); public static final DecimalFormat dFormat2 = new DecimalFormat(#,##0.00); public static final SimpleDateFormat df1 = new SimpleDateFormat(HH:mm); public static final SimpleDateFormat df2 = new SimpleDateFormat(EEE, d MMM, ); } the apps, frequently related to use of static variables to hold references to various session- or __ 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: Connection pooling verse one connection per session
From: Mark Winslow [mailto:[EMAIL PROTECTED] Subject: RE: Connection pooling verse one connection per session The memory usage grows and grows unexplicably. Modern JVMs also try to avoid doing GC if they can. So, if you've given the JVM a large amount of memory, it will use it all before attempting a GC. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection pooling verse one connection per session
From: Mark Winslow [mailto:[EMAIL PROTECTED] Subject: RE: Connection pooling verse one connection per session Sorry, just had one other question about the use of static variables. Can this really be a problem? I thought that a static variable only gets a single copy per JVM/Context. For instance the use of static variables to define formats shouls save on memory usage shouldn't it? I didn't mean to imply earlier that all static variable usage was bad, just that it can be easily abused in a fashion that leads to memory leaks. The usages you've outlined seem quite appropriate. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Pooling with Tomcat 4.1 and SQL Server 2000
Everything you did with the driver,server.xml,web.xml is ok. But it sounds like your driver of sql server 2000 doesnt support connection pooling ... did you tried to connect without the connection pool? i also recommend going to tomcat 5... i had a couple of issues with connection pooling in tomcat 4 with db2 so i went to tomcat 5. now everything is just better. Johnson, Jay escribió: I am trying to establish a connection pool in Tomcat 4.1 to SQL Server 2000. Looking at the SQL Server trace utility, it appears Tomcat connects with the correct username/password and then the following exception is thrown: java.lang.UnsupportedOperationException at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSourc e.java:161). I have taken the following steps: 1)Moved the driver jar files to /common/lib/ 2)Modified the Server.xml file 3)Modified the web.xml file of the application Here is my Server.xml entry: DefaultContext Resource name=jdbc/test auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/test parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://localhost:1433/value /parameter parameter nameusername/name valuejay/value /parameter parameter namepassword/name valuejay/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /DefaultContext Here is my entry in the web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/test/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Are any additional entries needed? Any help would be greatly appreciated! Thanks, Jay Johnson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling with Tomcat 4.1 and SQL Server 2000
I can connect using my current driver without connection pooling. You may be correct; the driver may not support it. I'm using Microsoft's standard type 4 driver. I'll try using Tomcat 5 also and see if it makes a difference. I'll also see if I can find another driver. Thanks for help! -Original Message- From: Friedrich Gonzalez [mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 6:10 AM To: Tomcat Users List Subject: Re: Connection Pooling with Tomcat 4.1 and SQL Server 2000 Everything you did with the driver,server.xml,web.xml is ok. But it sounds like your driver of sql server 2000 doesnt support connection pooling ... did you tried to connect without the connection pool? i also recommend going to tomcat 5... i had a couple of issues with connection pooling in tomcat 4 with db2 so i went to tomcat 5. now everything is just better. Johnson, Jay escribió: I am trying to establish a connection pool in Tomcat 4.1 to SQL Server 2000. Looking at the SQL Server trace utility, it appears Tomcat connects with the correct username/password and then the following exception is thrown: java.lang.UnsupportedOperationException at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSourc e.java:161). I have taken the following steps: 1)Moved the driver jar files to /common/lib/ 2)Modified the Server.xml file 3)Modified the web.xml file of the application Here is my Server.xml entry: DefaultContext Resource name=jdbc/test auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/test parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://localhost:1433/value /parameter parameter nameusername/name valuejay/value /parameter parameter namepassword/name valuejay/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value100/value /parameter /ResourceParams /DefaultContext Here is my entry in the web.xml file: resource-ref descriptionDB Connection/description res-ref-namejdbc/test/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref Are any additional entries needed? Any help would be greatly appreciated! Thanks, Jay Johnson - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
thats what I hope this is, the guy who was before me wasnt that great at anything other then coding swing apps, so tomcat the server and database are a mess. From: Filip Hanik - Dev [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Re: connection pooling Date: Thu, 16 Dec 2004 16:13:03 -0600 depends on what connection pool you use. but in almost all causes, its a pretty trivial thing (unless your code is funky of course) in our system, all we did was to switch the driver name (to the pooled driver), and it would pick up our connection pool. so it was a one line change. Filip - Original Message - From: Didier McGillis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 16, 2004 3:49 PM Subject: connection pooling I'm about to the point where I'm going to switch to db connection pooling. however before I undertake this seemly easy task I have a question, which will make this a huge project or a simple one. The current site uses typical MySQL connection, where a connection is opened and so on, if I do connection pooling will I have to go in and do mass code changes? aka will I have to rewrite any servlets or jsps that make database calls. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
depends on what connection pool you use. but in almost all causes, its a pretty trivial thing (unless your code is funky of course) in our system, all we did was to switch the driver name (to the pooled driver), and it would pick up our connection pool. so it was a one line change. Filip - Original Message - From: Didier McGillis [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, December 16, 2004 3:49 PM Subject: connection pooling I'm about to the point where I'm going to switch to db connection pooling. however before I undertake this seemly easy task I have a question, which will make this a huge project or a simple one. The current site uses typical MySQL connection, where a connection is opened and so on, if I do connection pooling will I have to go in and do mass code changes? aka will I have to rewrite any servlets or jsps that make database calls. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling
Worth clarifyig what we are meaning by DBCP. The DBCP I was referring to was the specific implementation of connection pooling that is part of Jakarta Commons: http://jakarta.apache.org/commons/dbcp/ There are other pooling implementations which are alternatives to Commons DBCP. Some DB drivers included pooling support as-is. Others do not. For those that do not, you need to implement pooling by building code around the standard driver. You used to have to do this yourself, but now there is DBCP to take care of this for you. DBCP is a wrapper used around a non-pooling DB driver. So, hence my question, are you intending to use DBCP, or does your Informix driver include pooling? From the JNDI/JDBC guides it appears that you have the choice of using DBCP or not (although there is one aspect of the docs that seem slightly unclear on that, which I am going start another thread to clear up). The configs are similar. Personally I have only got the DBCP approach to work, hence my suggestion of using that, for which you need to include the factory parameter. What this does is basically tells TC to call DBCP rather than your database driver when making a connection - DBCP then calls your DB driver if and when it needs to. I think I'm right in saying that if you don't explcitly use DBCP, and your DB driver does not support pooling, you will end up with non-pooled connections. The webapp will still work but you will not have the advantages of pooling. In case it helps, here are my ResourceParams. Note that I have both factory and driverClassName: ResourceParams name=jdbc/myDb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameusername/name valueme/value /parameter parameter namepassword/name valuesecret/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/myDb/value /parameter /ResourceParams -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 18:34 To: Steve Kirk Cc: Tomcat Users List Subject: Re: connection pooling Steve, I am trying to use DBCP(hence the subject of the thread) and I believe I have a driver that supports it. Especially considering that the connection works when I wrap my data resource in a DefaultContext tag inside a stand alone Engine tag(server.xml), instead of inside a Context tag(how all instructions I've followed so far suggest). This means my driver support DBCP, correct? The only source code I imagine would help is the code I use to gain connection... Context initialContext = new InitialContext(); Context context = (Context) initialContext.lookup(java:comp/env); DataSource dataSource = (DataSource) context.lookup(jdbc/wms); connection = dataSource.getConnection(); I have seen no mention of this factory class parameter you speak of. I'm using TC 5.0.28. I'll try it. thx much for your help Eric On Fri, 5 Nov 2004 13:30:35 -, Steve Kirk [EMAIL PROTECTED] wrote: Eric - you are correct, you do not need both resource-ref and Resource (although I've found that having both does not cause a problem). Back to your problem. The error message indicates that TC cannot find the Resource. I'm not sure if you are trying to use DBCP or not (in other words, does the informix driver support pooling on its own, or do you in fact need DBCP or some other implementation wrapped around it)? You have res-typejavax.sql.DataSource/res-type but do not list the factory class under your Resource, e.g. : parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter I have not seen any Java source code on this thread, maybe you posted it before I started reading it. Thinking slightly laterally I'll pass on something I learned from Yoav recently on this list you don't need to use container-managed resources to do connection pooling. In other words you don't need to set any Resource or Context to get it to work. -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 05:57 To: Tomcat Users List; Atishay Kumar Subject: Re: connection pooling Thx for your input but, as mentioned in my previous message, I've tried this and it does not work. Also, considering my web.xml I shouldn't need this, correct? I have a resource-ref in my web.xml. Eric
Re: connection pooling
Well, my informix driver does support connection pooling as-is so I do not need to use a Jakarta Commons DBCP wrapper in order to take advantage of database connection pooling. Thx for clarifying and for sharing your ResourceParams. I need to study this issue some more in general since I only have a surface understanding of what connection pooling really is and what it's advantages are. For now, my app is successfully utilizing connection pooling, as far as I can tell. My problem, which initiated this thread, has been solved by putting a myapp.xml with the necessary context in my $CATALINA_HOME/conf/Catalina/localhost/ directory. thx Eric On Tue, 9 Nov 2004 00:40:23 -, Steve Kirk [EMAIL PROTECTED] wrote: Worth clarifyig what we are meaning by DBCP. The DBCP I was referring to was the specific implementation of connection pooling that is part of Jakarta Commons: http://jakarta.apache.org/commons/dbcp/ There are other pooling implementations which are alternatives to Commons DBCP. Some DB drivers included pooling support as-is. Others do not. For those that do not, you need to implement pooling by building code around the standard driver. You used to have to do this yourself, but now there is DBCP to take care of this for you. DBCP is a wrapper used around a non-pooling DB driver. So, hence my question, are you intending to use DBCP, or does your Informix driver include pooling? From the JNDI/JDBC guides it appears that you have the choice of using DBCP or not (although there is one aspect of the docs that seem slightly unclear on that, which I am going start another thread to clear up). The configs are similar. Personally I have only got the DBCP approach to work, hence my suggestion of using that, for which you need to include the factory parameter. What this does is basically tells TC to call DBCP rather than your database driver when making a connection - DBCP then calls your DB driver if and when it needs to. I think I'm right in saying that if you don't explcitly use DBCP, and your DB driver does not support pooling, you will end up with non-pooled connections. The webapp will still work but you will not have the advantages of pooling. In case it helps, here are my ResourceParams. Note that I have both factory and driverClassName: ResourceParams name=jdbc/myDb parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameusername/name valueme/value /parameter parameter namepassword/name valuesecret/value /parameter parameter nameurl/name valuejdbc:mysql://localhost:3306/myDb/value /parameter /ResourceParams -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 18:34 To: Steve Kirk Cc: Tomcat Users List Subject: Re: connection pooling Steve, I am trying to use DBCP(hence the subject of the thread) and I believe I have a driver that supports it. Especially considering that the connection works when I wrap my data resource in a DefaultContext tag inside a stand alone Engine tag(server.xml), instead of inside a Context tag(how all instructions I've followed so far suggest). This means my driver support DBCP, correct? The only source code I imagine would help is the code I use to gain connection... Context initialContext = new InitialContext(); Context context = (Context) initialContext.lookup(java:comp/env); DataSource dataSource = (DataSource) context.lookup(jdbc/wms); connection = dataSource.getConnection(); I have seen no mention of this factory class parameter you speak of. I'm using TC 5.0.28. I'll try it. thx much for your help Eric On Fri, 5 Nov 2004 13:30:35 -, Steve Kirk [EMAIL PROTECTED] wrote: Eric - you are correct, you do not need both resource-ref and Resource (although I've found that having both does not cause a problem). Back to your problem. The error message indicates that TC cannot find the Resource. I'm not sure if you are trying to use DBCP or not (in other words, does the informix driver support pooling on its own, or do you in fact need DBCP or some other implementation wrapped around it)? You have res-typejavax.sql.DataSource/res-type but do not list the factory class under your Resource, e.g. : parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter
Re: AW: {an alternative}Re: connection pooling
What escapes me is, why is this not more obviously documented? Perhaps it's in the Tomcat docs but I mostly abandoned those some time ago as they are so amazingly detailed and lengthy that unless you want to become a TC guru, which I am inspired to try and be more like, there is simply too much info. How can you post a paragraph like that and expect to be taken seriously? In one breath, you complain about something not being documented, then state that you don't read the documentation because it's too detailed? How can you know what is or isn't obviously documented if you don't read the documentation? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: {an alternative}Re: connection pooling
in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all -- :) Atishay Kumar Btech, SEM VII DA-IICT Gandhinagar - 382009 India ph: +91 9825383948 / * Learn the rules as you would need them to break them properly * / -- :) Atishay Kumar Btech, SEM VII DA-IICT Gandhinagar - 382009 India ph: +91 9825383948 / * Learn the rules as you would need them to break them properly * / - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
How about try to move your application (wms) out of the webapps directory, let's say: c:\wms Then in the server.xml, try to change docBase in the context: docBase=c:\wms Now, see if your application works or give a different error. Remember to drop the jdbc library into the common/lib folder. Eric Wulff wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... resource-ref res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref server xml(tried this with and without a Resource name)... Context path=/wms docBase=wms debug=0 reloadable=true ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value
RE: connection pooling
Eric - you are correct, you do not need both resource-ref and Resource (although I've found that having both does not cause a problem). Back to your problem. The error message indicates that TC cannot find the Resource. I'm not sure if you are trying to use DBCP or not (in other words, does the informix driver support pooling on its own, or do you in fact need DBCP or some other implementation wrapped around it)? You have res-typejavax.sql.DataSource/res-type but do not list the factory class under your Resource, e.g. : parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter I have not seen any Java source code on this thread, maybe you posted it before I started reading it. Thinking slightly laterally I'll pass on something I learned from Yoav recently on this list you don't need to use container-managed resources to do connection pooling. In other words you don't need to set any Resource or Context to get it to work. -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 05:57 To: Tomcat Users List; Atishay Kumar Subject: Re: connection pooling Thx for your input but, as mentioned in my previous message, I've tried this and it does not work. Also, considering my web.xml I shouldn't need this, correct? I have a resource-ref in my web.xml. Eric On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: Pls do the following change after context.. and u are on!! cheers On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... resource-ref res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref server xml(tried this with and without a Resource name)... Context path=/wms docBase=wms debug=0 reloadable=true Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORM IXSERVER=serverName/value /parameter /ResourceParams /Context I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote
RE: connection pooling
Hi, Eric - you are correct, you do not need both resource-ref and Resource That's only because we try to accommodate less able developers/administrators. You DO need resource-ref if you want your app to be compliant with the Servlet Specification and portable to other containers. Yoav Shapira http://www.yoavshapira.com This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling
Ah yes I agree, but that's not quite what I was saying. Eric, sorry if that was misleading. Eric has a resource-ref already. I meant that if you have resource-ref you do not need Resource as well in TC, because this is what the TC docs say, and the Resource tag is a TC invention rather than something required by the servlet spec. I think Yoav is saying that in fact TC allows you to be slightly loose by omitting the resource-ref as long as you have the Resource, even though strictly speaking you are not spec-compliant if you do this. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 13:32 To: Tomcat Users List Subject: RE: connection pooling Hi, Eric - you are correct, you do not need both resource-ref and Resource That's only because we try to accommodate less able developers/administrators. You DO need resource-ref if you want your app to be compliant with the Servlet Specification and portable to other containers. Yoav Shapira http://www.yoavshapira.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: {an alternative}Re: connection pooling
Eric said: Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. when you deploy a mywebapp from a warfile that includes a META-INF/context.xml, TC copies that file to conf/Catalina/localhost/mywebapp.xml. having said that there appear to be situations where TC does and does not copy that file. all I can say is that it works for me (5.0.28). Or, you can create that file yourself. whichever way it's created, its contents are taken as though they were inserted as a context under the Catalina/localhost host in server.xml. this is the preferred way to config a context since v5.x (rather than putting it in server.xml). manager.xml is for the manager webapp. -Original Message- From: Nick Pellow [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 07:40 To: Tomcat Users List Subject: AW: {an alternative}Re: connection pooling HI Eric, I have seen the same error your are getting. I am using tomcat 5.0.28. Make sure that you have removed the expanded war directories, from webapps and ${CATALINA_HOME}/work before restarting. Also look inside those other context.xmls inside ${CATALINA_HOME}/conf/Catalina/localhost and make sure that they do not define a context with path=/wms. Cheers, nick. -Ursprungliche Nachricht- Von: Eric Wulff [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 5. November 2004 07:35 An: Atishay Kumar Cc: Tomcat Users List Betreff: Re: {an alternative}Re: connection pooling Atishay, the DefaultContext does work once I comment out the other Engine element. You mentioned that means something is wrong with my Context? So what next? many thx Eric On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff [EMAIL PROTECTED] wrote: This did not work. In looking for the Engine element you speak of I didn't find it exactly. I did find it with it with an extra attribute Engine name=Standalone... jvmRoute=jvm1. Furthermore, this element was nested within the Service element and there is another Engine name=Catalina... element. I tried with and without the jvmRoute element. No success. Same exception. Eric On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER VER=serverName/value /parameter /ResourceParams replace /Context with /DefaultContext !-- If this works them there is something wrong with your context. we shall figure that out later but first
Re: AW: {an alternative}Re: connection pooling
I thought I have read back in this same thread that he had two Engine under a Service ? Only one Engine is allowed per Service to fix one problem. --- Nick Pellow [EMAIL PROTECTED] wrote: HI Eric, I have seen the same error your are getting. I am using tomcat 5.0.28. Make sure that you have removed the expanded war directories, from webapps and ${CATALINA_HOME}/work before restarting. Also look inside those other context.xmls inside ${CATALINA_HOME}/conf/Catalina/localhost and make sure that they do not define a context with path=/wms. Cheers, nick. -Ursprungliche Nachricht- Von: Eric Wulff [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 5. November 2004 07:35 An: Atishay Kumar Cc: Tomcat Users List Betreff: Re: {an alternative}Re: connection pooling Atishay, the DefaultContext does work once I comment out the other Engine element. You mentioned that means something is wrong with my Context? So what next? many thx Eric On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff [EMAIL PROTECTED] wrote: This did not work. In looking for the Engine element you speak of I didn't find it exactly. I did find it with it with an extra attribute Engine name=Standalone... jvmRoute=jvm1. Furthermore, this element was nested within the Service element and there is another Engine name=Catalina... element. I tried with and without the jvmRoute element. No success. Same exception. Eric On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER VER=serverName/value /parameter /ResourceParams replace /Context with /DefaultContext !-- If this works them there is something wrong with your context. we shall figure that out later but first DefaultContext should work!! restart tommy after making changes. hope it works!! -- I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site
Re: connection pooling
Steve, I am trying to use DBCP(hence the subject of the thread) and I believe I have a driver that supports it. Especially considering that the connection works when I wrap my data resource in a DefaultContext tag inside a stand alone Engine tag(server.xml), instead of inside a Context tag(how all instructions I've followed so far suggest). This means my driver support DBCP, correct? The only source code I imagine would help is the code I use to gain connection... Context initialContext = new InitialContext(); Context context = (Context) initialContext.lookup(java:comp/env); DataSource dataSource = (DataSource) context.lookup(jdbc/wms); connection = dataSource.getConnection(); I have seen no mention of this factory class parameter you speak of. I'm using TC 5.0.28. I'll try it. thx much for your help Eric On Fri, 5 Nov 2004 13:30:35 -, Steve Kirk [EMAIL PROTECTED] wrote: Eric - you are correct, you do not need both resource-ref and Resource (although I've found that having both does not cause a problem). Back to your problem. The error message indicates that TC cannot find the Resource. I'm not sure if you are trying to use DBCP or not (in other words, does the informix driver support pooling on its own, or do you in fact need DBCP or some other implementation wrapped around it)? You have res-typejavax.sql.DataSource/res-type but do not list the factory class under your Resource, e.g. : parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter I have not seen any Java source code on this thread, maybe you posted it before I started reading it. Thinking slightly laterally I'll pass on something I learned from Yoav recently on this list you don't need to use container-managed resources to do connection pooling. In other words you don't need to set any Resource or Context to get it to work. -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: Friday 05 November 2004 05:57 To: Tomcat Users List; Atishay Kumar Subject: Re: connection pooling Thx for your input but, as mentioned in my previous message, I've tried this and it does not work. Also, considering my web.xml I shouldn't need this, correct? I have a resource-ref in my web.xml. Eric On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: Pls do the following change after context.. and u are on!! cheers On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... resource-ref res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref server xml(tried this with and without a Resource name)... Context path=/wms docBase=wms debug=0 reloadable=true Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORM IXSERVER=serverName/value /parameter /ResourceParams /Context I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar
Re: AW: {an alternative}Re: connection pooling
OK - Got It! Thank you all many times over for your time and help on this connection pool thing. It is surprisingly difficult to maintain a stable environment if you're a curious beginner. I clearly need to get a grip on Tomcat's process BUT it also seems abundantly clear that docs/how to's for simply getting started with connection pools are less than optimal. What exactly was my problem? Still not sure and trying to narrow it down. In the hopes of helping anyone on this list, here's what FINALLY worked for me? Again, I'm running TC 5.0.28 on Linux FC2 1. I went in and cleared out ALL my test web-apps, of which I wrote about 6 different toys via tutorials and on my own. While I don't nearly understand the reasons for much of the TC directory structure, I traversed the following directories and 'rm -r -f' all the webaps I created and no longer wanted with the thinking that somehow they might be in the way... the obvious... CATALINA_HOME/webaps/ the less obvious to me... CATALINA_HOME/work/StandAlone/localhost CATALINA_HOME/work/Catalina/localhost 2. This, I'm guessing, is more likely the key but I didn't test between doing all this. I created a new file, myapp.xml, in... CATALINA_HOME/conf/Catalina/localhost/ and simply copied the related Context/Context(see prior emails) from the server.xml in... CATALINA_HOME/conf/ to this file. What escapes me is, why is this not more obviously documented? Perhaps it's in the Tomcat docs but I mostly abandoned those some time ago as they are so amazingly detailed and lengthy that unless you want to become a TC guru, which I am inspired to try and be more like, there is simply too much info. Okay, I'm off to continue figuring why TC keeps crashing on me. Hopefully something I did here solved that problem too. thx again all, Eric On Fri, 5 Nov 2004 08:39:30 +0100, Nick Pellow [EMAIL PROTECTED] wrote: HI Eric, I have seen the same error your are getting. I am using tomcat 5.0.28. Make sure that you have removed the expanded war directories, from webapps and ${CATALINA_HOME}/work before restarting. Also look inside those other context.xmls inside ${CATALINA_HOME}/conf/Catalina/localhost and make sure that they do not define a context with path=/wms. Cheers, nick. -Ursprungliche Nachricht- Von: Eric Wulff [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 5. November 2004 07:35 An: Atishay Kumar Cc: Tomcat Users List Betreff: Re: {an alternative}Re: connection pooling Atishay, the DefaultContext does work once I comment out the other Engine element. You mentioned that means something is wrong with my Context? So what next? many thx Eric On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff [EMAIL PROTECTED] wrote: This did not work. In looking for the Engine element you speak of I didn't find it exactly. I did find it with it with an extra attribute Engine name=Standalone... jvmRoute=jvm1. Furthermore, this element was nested within the Service element and there is another Engine name=Catalina... element. I tried with and without the jvmRoute element. No success. Same exception. Eric On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource
Re: connection pooling
Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... resource-ref res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref server xml(tried this with and without a Resource name)... Context path=/wms docBase=wms debug=0 reloadable=true ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value /parameter parameter
Re: connection pooling
Pls do the following change after context.. and u are on!! cheers On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... resource-ref res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref server xml(tried this with and without a Resource name)... Context path=/wms docBase=wms debug=0 reloadable=true Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter
{an alternative}Re: connection pooling
If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams replace /Context with /DefaultContext !-- If this works them there is something wrong with your context. we shall figure that out later but first DefaultContext should work!! restart tommy after making changes. hope it works!! -- I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all -- :) Atishay Kumar Btech, SEM VII DA-IICT Gandhinagar - 382009 India ph: +91 9825383948 / * Learn the rules as you would need them to break them properly * / - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
Thx for your input but, as mentioned in my previous message, I've tried this and it does not work. Also, considering my web.xml I shouldn't need this, correct? I have a resource-ref in my web.xml. Eric On Fri, 5 Nov 2004 11:01:05 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: Pls do the following change after context.. and u are on!! cheers On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... resource-ref res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref server xml(tried this with and without a Resource name)... Context path=/wms docBase=wms debug=0 reloadable=true Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter
Re: {an alternative}Re: connection pooling
This did not work. In looking for the Engine element you speak of I didn't find it exactly. I did find it with it with an extra attribute Engine name=Standalone... jvmRoute=jvm1. Furthermore, this element was nested within the Service element and there is another Engine name=Catalina... element. I tried with and without the jvmRoute element. No success. Same exception. Eric On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams replace /Context with /DefaultContext !-- If this works them there is something wrong with your context. we shall figure that out later but first DefaultContext should work!! restart tommy after making changes. hope it works!! -- I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat
Re: {an alternative}Re: connection pooling
Atishay, the DefaultContext does work once I comment out the other Engine element. You mentioned that means something is wrong with my Context? So what next? many thx Eric On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff [EMAIL PROTECTED] wrote: This did not work. In looking for the Engine element you speak of I didn't find it exactly. I did find it with it with an extra attribute Engine name=Standalone... jvmRoute=jvm1. Furthermore, this element was nested within the Service element and there is another Engine name=Catalina... element. I tried with and without the jvmRoute element. No success. Same exception. Eric On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams replace /Context with /DefaultContext !-- If this works them there is something wrong with your context. we shall figure that out later but first DefaultContext should work!! restart tommy after making changes. hope it works!! -- I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection
AW: {an alternative}Re: connection pooling
HI Eric, I have seen the same error your are getting. I am using tomcat 5.0.28. Make sure that you have removed the expanded war directories, from webapps and ${CATALINA_HOME}/work before restarting. Also look inside those other context.xmls inside ${CATALINA_HOME}/conf/Catalina/localhost and make sure that they do not define a context with path=/wms. Cheers, nick. -Ursprungliche Nachricht- Von: Eric Wulff [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 5. November 2004 07:35 An: Atishay Kumar Cc: Tomcat Users List Betreff: Re: {an alternative}Re: connection pooling Atishay, the DefaultContext does work once I comment out the other Engine element. You mentioned that means something is wrong with my Context? So what next? many thx Eric On Thu, 4 Nov 2004 22:21:57 -0800, Eric Wulff [EMAIL PROTECTED] wrote: This did not work. In looking for the Engine element you speak of I didn't find it exactly. I did find it with it with an extra attribute Engine name=Standalone... jvmRoute=jvm1. Furthermore, this element was nested within the Service element and there is another Engine name=Catalina... element. I tried with and without the jvmRoute element. No success. Same exception. Eric On Fri, 5 Nov 2004 11:20:26 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: If adding Resouce name .../ did not work..then try following On Thu, 4 Nov 2004 19:46:30 -0800, Eric Wulff [EMAIL PROTECTED] wrote: Hi all, I'm returning to a problem I couldn't solve the first time, about two months ago, and still can't seem to figure out. I can't get a db connection using connection pools. I get the exception listed below, same as so many have previously, but nothing I've found seems to works. Below are my specs. Anyone with concrete advise/direction on how to get this working? Also, I noticed in many solutions the suggestion was made to edit the myapp.xml file located at CATALINA_HOME/conf/Catalina/localhost/. However, there is no myapp.xml in that directory on my server. Just 2 .xml's related to other applications and a manager.xml which I'm not sure what it's related to. OS: FC2 Tomcat 5.0.28 exception: org.apache.commons.dbcp.SWLNestedException: Cannot create JDBC driver class '' for connect URL 'null' WEB-INF web xml: code inserted AFTER all servlet mappings... the following shld be in web-app resource-ref descriptionMy Datasource/description res-ref-namejdbc/wms/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app !-- I am sure u have this right-- server xml(tried this with and without a Resource name)... The following shld be under Engine name=Standalone defaultHost=localhost debug=0 REplace Context path=/wms docBase=wms debug=0 reloadable=true with DefaultContext Resource name=jdbc/wms auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/wms parameter nameusername/name valuewhatever/value /parameter parameter namepassword/name valuewhatever/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://foo.bar.com:somePort/dbName:INFORMIXSER VER=serverName/value /parameter /ResourceParams replace /Context with /DefaultContext !-- If this works them there is something wrong with your context. we shall figure that out later but first DefaultContext should work!! restart tommy after making changes. hope it works!! -- I have the following jars in my CATALINA_HONE/common/lib and I also tried putting the db driver and commons-collections, dbcp, and pool in my WEB-INF/lib with no success. They are all mode 644. ant.jar ant-launcher.jar commons-collections-3.1.jar commons-dbcp-1.2.1.jar commons-el.jar commons-pool-1.2.jar ifxjdbc.jar (the necessary informix driver) jar.txt jasper-compiler.jar jasper-runtime.jar jsp-api.jar mysql-connector-java-3.0.15-ga-bin.jar naming-common.jar naming-factory.jar naming-java.jar naming-resources.jar servlet-api.jar On Fri, 8 Oct 2004 11:45:59 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db
RE: Connection Pooling using JNDI DataSource
uh ... it works fine from our side. But as i saw so many posts concerning that point i was really puzzled it was so simple to set up :-) -Message d'origine- De : Steve Kirk [mailto:[EMAIL PROTECTED] Envoyé : mercredi 13 octobre 2004 16:56 À : 'Tomcat Users List' Objet : RE: Connection Pooling using JNDI DataSource As Yoav says, it works, and is very easy to use once you have it configured. But note that lots of people seem to have trouble getting the config right. I was one of those. You have to persevere a bit. The problem I had was that there are lots of pages on lots of websites that describe how to do it, and each page explains one of a number of different approaches (there is more than one way to do it, besides the one you linked to, but don't worry about that for now - the approach on that page is fine). Stick carefully to the set of instructions in your link, and it should work. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday 13 October 2004 15:26 To: Tomcat Users List Subject: RE: Connection Pooling using JNDI DataSource Hi, Yeah, it works. Note that your choice of words is a bit misleading: you don't configure anything in web.xml, you only declare a resource reference there. The declaration and configuration of the resource itself is all in server.xml. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Marot Laurent [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 10:33 AM To: Tomcat Users List Subject: Connection Pooling using JNDI DataSource Hi all, Could you please confirm me that when using JNDI DataSource described there http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasour ce-example s- howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurat ions (just defining the Datasource in your server.xml file and configuring the resource in web.xml) and adding the code below in every page (or better in a bean) i would get all the DBCP functionalities. So for instance, each time i'll made a getConnection i will use a connection from the pool and not creating one. Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle); Connection conn = ds.getConnection(); seems to be too simple to work this way, isn't it :-) Thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling using JNDI DataSource
I guess the issue is with compilation or JNI. -Original Message- From: Marot Laurent [mailto:[EMAIL PROTECTED] Sent: October 15, 2004 5:13 AM To: Tomcat Users List Subject: RE: Connection Pooling using JNDI DataSource uh ... it works fine from our side. But as i saw so many posts concerning that point i was really puzzled it was so simple to set up :-) -Message d'origine- De : Steve Kirk [mailto:[EMAIL PROTECTED] Envoyé : mercredi 13 octobre 2004 16:56 À : 'Tomcat Users List' Objet : RE: Connection Pooling using JNDI DataSource As Yoav says, it works, and is very easy to use once you have it configured. But note that lots of people seem to have trouble getting the config right. I was one of those. You have to persevere a bit. The problem I had was that there are lots of pages on lots of websites that describe how to do it, and each page explains one of a number of different approaches (there is more than one way to do it, besides the one you linked to, but don't worry about that for now - the approach on that page is fine). Stick carefully to the set of instructions in your link, and it should work. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday 13 October 2004 15:26 To: Tomcat Users List Subject: RE: Connection Pooling using JNDI DataSource Hi, Yeah, it works. Note that your choice of words is a bit misleading: you don't configure anything in web.xml, you only declare a resource reference there. The declaration and configuration of the resource itself is all in server.xml. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Marot Laurent [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 10:33 AM To: Tomcat Users List Subject: Connection Pooling using JNDI DataSource Hi all, Could you please confirm me that when using JNDI DataSource described there http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasour ce-example s- howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurat ions (just defining the Datasource in your server.xml file and configuring the resource in web.xml) and adding the code below in every page (or better in a bean) i would get all the DBCP functionalities. So for instance, each time i'll made a getConnection i will use a connection from the pool and not creating one. Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle); Connection conn = ds.getConnection(); seems to be too simple to work this way, isn't it :-) Thanks - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] !DSPAM:416f927827771507119519!
RE: Connection Pooling using JNDI DataSource
Hi, Yeah, it works. Note that your choice of words is a bit misleading: you don't configure anything in web.xml, you only declare a resource reference there. The declaration and configuration of the resource itself is all in server.xml. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Marot Laurent [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 10:33 AM To: Tomcat Users List Subject: Connection Pooling using JNDI DataSource Hi all, Could you please confirm me that when using JNDI DataSource described there http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-example s- howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations (just defining the Datasource in your server.xml file and configuring the resource in web.xml) and adding the code below in every page (or better in a bean) i would get all the DBCP functionalities. So for instance, each time i'll made a getConnection i will use a connection from the pool and not creating one. Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle); Connection conn = ds.getConnection(); seems to be too simple to work this way, isn't it :-) Thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling using JNDI DataSource
As Yoav says, it works, and is very easy to use once you have it configured. But note that lots of people seem to have trouble getting the config right. I was one of those. You have to persevere a bit. The problem I had was that there are lots of pages on lots of websites that describe how to do it, and each page explains one of a number of different approaches (there is more than one way to do it, besides the one you linked to, but don't worry about that for now - the approach on that page is fine). Stick carefully to the set of instructions in your link, and it should work. -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday 13 October 2004 15:26 To: Tomcat Users List Subject: RE: Connection Pooling using JNDI DataSource Hi, Yeah, it works. Note that your choice of words is a bit misleading: you don't configure anything in web.xml, you only declare a resource reference there. The declaration and configuration of the resource itself is all in server.xml. Yoav Shapira http://www.yoavshapira.com -Original Message- From: Marot Laurent [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 13, 2004 10:33 AM To: Tomcat Users List Subject: Connection Pooling using JNDI DataSource Hi all, Could you please confirm me that when using JNDI DataSource described there http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasour ce-example s- howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurat ions (just defining the Datasource in your server.xml file and configuring the resource in web.xml) and adding the code below in every page (or better in a bean) i would get all the DBCP functionalities. So for instance, each time i'll made a getConnection i will use a connection from the pool and not creating one. Context initContext = new InitialContext(); Context envContext = (Context)initContext.lookup(java:/comp/env); DataSource ds = (DataSource)envContext.lookup(jdbc/myoracle); Connection conn = ds.getConnection(); seems to be too simple to work this way, isn't it :-) Thanks - 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: connection pooling
hi, i am not sure but you may try downloading latest jar files for following froom tomcat site and try them out. copy the old jar files somewhere else and try using the latest jar files. 1) Commons Collections 2)Commons DBCP 3)Commons Pool On Thu, 7 Oct 2004 15:29:40 -0700, Eric Wulff [EMAIL PROTECTED] wrote: Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value /parameter parameter namemaxWait/name value15000/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namevalidationQuery/name valueyour_query/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter parameter nametestOnReturn/name valuetrue/value /parameter parameter nameminEvictableIdleTimeMillis/name value-1/value /parameter !-- sleeps 5 minutes -- parameter nametimeBetweenEvictionRunsMillis/name value30/value /parameter parameter namenumTestsPerEvictionRun/name value1/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter /ResourceParams 3. code Context initContext = new InitialContext(); Context jdbcContext = (Context) initContext.lookup(java:comp/env); DataSource dataSource = (DataSource) jdbcContext.lookup(jdbc/test_connect); ... -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 4:34 PM To: Tomcat Users List Subject: Re: connection pooling Hi Phillip, On Thu, 7 Oct 2004 09:29:09 -0400, you wrote: Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. This was all included in my original post. Ok, actually my 2nd post because I accidentally hit send prior to completing my post via the scroll pad on my laptop. Still, thx for checking on this and the info you looking for is copied again here... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC
RE: connection pooling
Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 6, 2004 5:09 PM To: [EMAIL PROTECTED] Subject: connection pooling Hi all, I have gone over some of the tomcat docs and googled errors but there is SO much information covering JNDI and Datasources... and I'm hoping I don't have to be a JNDI/Datasource and XML guru just to set up db connections via connection pool. My situation is this... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). -This leads me to believe that my jdbc driver is in the correct place ...CATALINA - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] !DSPAM:41645f0c199801939649086!
Re: connection pooling
On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff [EMAIL PROTECTED] wrote: I have gone over some of the tomcat docs and googled errors but there is SO much information covering JNDI, connection pooling, and Datasources. Can someone review the info below and consult or point me in the right direction? Although I feel I'm missing something obvious, I can't find out what's wrong with my set-up. thx Eric System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping servlet-nameTest Connection Pooling/servlet-name url-pattern/testConnectionPooling/url-pattern /servlet-mapping resource-ref res-ref-namejdbc/test_connect/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app server.xml Context: Context path=/testConnectionPooling docBase=testConnectionPooling debug=0 reloadable=true Resource name=jdbc/test_connection auth=Container type=javax.sql.DataSource/ is missing ResourceParams name=jdbc/test_connect parameter nameusername/name valueinformix/value /parameter parameter namepassword/name valueinformix/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context .java: import java.io.*; import java.sql.*; // -Must import javax.naming use JNDI which is required to implement data // resource references and hence connection pooling. import javax.naming.*; import javax.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class TestConnectionPooling extends HttpServlet { private DataSource dataSource; public void init(ServletConfig config) throws ServletException { try { Context init = new InitialContext(); // don't know what the 'java:comp/env' refers to Context ctx = (Context) init.lookup(java:comp/env); // I know jdbc/conversion must match the web.xml res-ref-name of the web.xml but don't know what the path really refers to dataSource = (DataSource) ctx.lookup(jdbc/test_connect); } catch (NamingException ex) { throw new ServletException(Cannot retrieve java:comp/env/jdbc/test_connect,ex); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(text/html); PrintWriter out = response.getWriter(); Connection connection = null; out.println (HTMLHEADTITLETest Connection Pooling/TITLE/HEADBODY); out.println(H1Customer Name Query/H1); try { synchronized(dataSource) { connection = dataSource.getConnection(); } out.println(br); out.println(strongLoaded informix driver successfully via server.xml./strong + Now attempting db connection.); out.println(br); PreparedStatement pstmt = connection.prepareStatement(SELECT blah FROM blah blah); ResultSet results =
Re: connection pooling
Hi Phillip, On Thu, 7 Oct 2004 09:29:09 -0400, you wrote: Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. This was all included in my original post. Ok, actually my 2nd post because I accidentally hit send prior to completing my post via the scroll pad on my laptop. Still, thx for checking on this and the info you looking for is copied again here... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping servlet-nameTest Connection Pooling/servlet-name url-pattern/testConnectionPooling/url-pattern /servlet-mapping resource-ref res-ref-namejdbc/test_connect/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app server.xml Context: Context path=/testConnectionPooling docBase=testConnectionPooling debug=0 reloadable=true ResourceParams name=jdbc/test_connect parameter nameusername/name valueinformix/value /parameter parameter namepassword/name valueinformix/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context .java: import java.io.*; import java.sql.*; // -Must import javax.naming use JNDI which is required to implement data // resource references and hence connection pooling. import javax.naming.*; import javax.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class TestConnectionPooling extends HttpServlet { private DataSource dataSource; public void init(ServletConfig config) throws ServletException { try { Context init = new InitialContext(); // don't know what the 'java:comp/env' refers to Context ctx = (Context) init.lookup(java:comp/env); // I know jdbc/conversion must match the web.xml res-ref-name of the web.xml but don't know what the path really refers to dataSource = (DataSource) ctx.lookup(jdbc/test_connect); } catch (NamingException ex) { throw new ServletException(Cannot retrieve java:comp/env/jdbc/test_connect,ex); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(text/html); PrintWriter out = response.getWriter(); Connection connection = null; out.println (HTMLHEADTITLETest Connection Pooling/TITLE/HEADBODY); out.println(H1Customer Name Query/H1); try { synchronized(dataSource) { connection = dataSource.getConnection(); } out.println(br); out.println(strongLoaded informix driver successfully via server.xml./strong + Now attempting db connection.); out.println(br); PreparedStatement pstmt = connection.prepareStatement(SELECT blah FROM blah blah); ResultSet results = pstmt.executeQuery(); if (!results.next()) { throw new SQLException(No data returned for some
Re: connection pooling
Hi Atishay, added your suggestion to the server.xml. While it is not the fix, I do have a different error listing. Is this a clue to you? Eric current last listing of stack trace... Caused by: java.lang.NullPointerException at com.informix.jdbc.IfxDriver.checkURL(IfxDriver.java:473) at com.informix.jdbc.IfxDriver.acceptsURL(IfxDriver.java:297) at java.sql.DriverManager.getDriver(DriverManager.java:232) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) ... 28 more original last listing of stack trace... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) On Thu, 7 Oct 2004 19:17:14 +0530, Atishay Kumar [EMAIL PROTECTED] wrote: On Wed, 6 Oct 2004 14:37:58 -0700, Eric Wulff [EMAIL PROTECTED] wrote: I have gone over some of the tomcat docs and googled errors but there is SO much information covering JNDI, connection pooling, and Datasources. Can someone review the info below and consult or point me in the right direction? Although I feel I'm missing something obvious, I can't find out what's wrong with my set-up. thx Eric System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping servlet-nameTest Connection Pooling/servlet-name url-pattern/testConnectionPooling/url-pattern /servlet-mapping resource-ref res-ref-namejdbc/test_connect/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app server.xml Context: Context path=/testConnectionPooling docBase=testConnectionPooling debug=0 reloadable=true Resource name=jdbc/test_connection auth=Container type=javax.sql.DataSource/ is missing ResourceParams name=jdbc/test_connect parameter nameusername/name valueinformix/value /parameter parameter namepassword/name valueinformix/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context .java: import java.io.*; import java.sql.*; // -Must import javax.naming use JNDI which is required to implement data // resource references and hence connection pooling. import javax.naming.*; import javax.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class TestConnectionPooling extends HttpServlet { private DataSource dataSource; public void init(ServletConfig config) throws ServletException { try { Context init = new InitialContext(); // don't know what the 'java:comp/env' refers to Context ctx = (Context) init.lookup(java:comp/env); // I know jdbc/conversion must match the web.xml res-ref-name of the web.xml but don't know what the path really refers to dataSource = (DataSource) ctx.lookup(jdbc/test_connect); } catch (NamingException ex) { throw new ServletException(Cannot retrieve java:comp/env/jdbc/test_connect,ex); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException,
RE: connection pooling
1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value /parameter parameter namemaxWait/name value15000/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namevalidationQuery/name valueyour_query/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter parameter nametestOnReturn/name valuetrue/value /parameter parameter nameminEvictableIdleTimeMillis/name value-1/value /parameter !-- sleeps 5 minutes -- parameter nametimeBetweenEvictionRunsMillis/name value30/value /parameter parameter namenumTestsPerEvictionRun/name value1/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter /ResourceParams 3. code Context initContext = new InitialContext(); Context jdbcContext = (Context) initContext.lookup(java:comp/env); DataSource dataSource = (DataSource) jdbcContext.lookup(jdbc/test_connect); ... -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 4:34 PM To: Tomcat Users List Subject: Re: connection pooling Hi Phillip, On Thu, 7 Oct 2004 09:29:09 -0400, you wrote: Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. This was all included in my original post. Ok, actually my 2nd post because I accidentally hit send prior to completing my post via the scroll pad on my laptop. Still, thx for checking on this and the info you looking for is copied again here... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping servlet-nameTest Connection Pooling/servlet-name url-pattern/testConnectionPooling/url-pattern /servlet-mapping resource-ref res-ref-namejdbc/test_connect/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app server.xml Context: Context path=/testConnectionPooling docBase=testConnectionPooling debug=0 reloadable=true ResourceParams name=jdbc/test_connect parameter nameusername/name valueinformix/value /parameter parameter namepassword/name valueinformix/value /parameter parameter namedriverClassName
Re: connection pooling
Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value /parameter parameter namemaxWait/name value15000/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namevalidationQuery/name valueyour_query/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter parameter nametestOnReturn/name valuetrue/value /parameter parameter nameminEvictableIdleTimeMillis/name value-1/value /parameter !-- sleeps 5 minutes -- parameter nametimeBetweenEvictionRunsMillis/name value30/value /parameter parameter namenumTestsPerEvictionRun/name value1/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter /ResourceParams 3. code Context initContext = new InitialContext(); Context jdbcContext = (Context) initContext.lookup(java:comp/env); DataSource dataSource = (DataSource) jdbcContext.lookup(jdbc/test_connect); ... -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 4:34 PM To: Tomcat Users List Subject: Re: connection pooling Hi Phillip, On Thu, 7 Oct 2004 09:29:09 -0400, you wrote: Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. This was all included in my original post. Ok, actually my 2nd post because I accidentally hit send prior to completing my post via the scroll pad on my laptop. Still, thx for checking on this and the info you looking for is copied again here... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.jav a:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping
RE: connection pooling
No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value /parameter parameter namemaxWait/name value15000/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namevalidationQuery/name valueyour_query/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter parameter nametestOnReturn/name valuetrue/value /parameter parameter nameminEvictableIdleTimeMillis/name value-1/value /parameter !-- sleeps 5 minutes -- parameter nametimeBetweenEvictionRunsMillis/name value30/value /parameter parameter namenumTestsPerEvictionRun/name value1/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter /ResourceParams 3. code Context initContext = new InitialContext(); Context jdbcContext = (Context) initContext.lookup(java:comp/env); DataSource dataSource = (DataSource) jdbcContext.lookup(jdbc/test_connect); ... -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 4:34 PM To: Tomcat Users List Subject: Re: connection pooling Hi Phillip, On Thu, 7 Oct 2004 09:29:09 -0400, you wrote: Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. This was all included in my original post. Ok, actually my 2nd post because I accidentally hit send prior to completing my post via the scroll pad on my laptop. Still, thx for checking on this and the info you looking for is copied again here... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSour ce.jav a:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun
Re: connection pooling
Except that the driver works for connecting if I'm not utilizing a connection pool, i.e., I am able to connect to the db and manipulate data via DriverManager.getConnection(url, db, pwd). The driver is located in CATALINA_HOME/commons/lib Eric On Thu, 7 Oct 2004 18:22:45 -0400, Phillip Qin [EMAIL PROTECTED] wrote: No, you don't need that many params. I think your problem might be the driver. Where did you drop off your informix jdbc jar? -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 5:56 PM To: Tomcat Users List Subject: Re: connection pooling Yes, I have added Resource name=... . Now different errors are reported via stack trace as I posted in response to Atishay's suggestion that I add this. I'll try adding your suggestions and see what happens. Also, you suggest adding many parameters. Are they necessary for simply making a connection? If so, the tutorial I'm following, 'Tomcat Kick Start' left all your suggestions out. Including the Resource tag, but that seems critical for connection. Eric On Thu, 7 Oct 2004 17:14:27 -0400, Phillip Qin [EMAIL PROTECTED] wrote: 1. web.xml: OK 2. context.xml on context of server.xml: Resource name=jdbc/test_connect auth=Container type=javax.sql.DataSource/ = have you added this? ResourceParams name=jdbc/test_connect parameter namedriverClassName/name valueyour.jdbc.driver/value /parameter parameter nameurl/name valueyour.jdbc.url/value /parameter parameter nameusername/name valueyouruser/value /parameter parameter namepassword/name valueyourpass/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter nameminIdle/name value10/value /parameter parameter namemaxWait/name value15000/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namevalidationQuery/name valueyour_query/value /parameter parameter nametestOnBorrow/name valuetrue/value /parameter parameter nametestOnReturn/name valuetrue/value /parameter parameter nameminEvictableIdleTimeMillis/name value-1/value /parameter !-- sleeps 5 minutes -- parameter nametimeBetweenEvictionRunsMillis/name value30/value /parameter parameter namenumTestsPerEvictionRun/name value1/value /parameter parameter nametestWhileIdle/name valuetrue/value /parameter /ResourceParams 3. code Context initContext = new InitialContext(); Context jdbcContext = (Context) initContext.lookup(java:comp/env); DataSource dataSource = (DataSource) jdbcContext.lookup(jdbc/test_connect); ... -Original Message- From: Eric Wulff [mailto:[EMAIL PROTECTED] Sent: October 7, 2004 4:34 PM To: Tomcat Users List Subject: Re: connection pooling Hi Phillip, On Thu, 7 Oct 2004 09:29:09 -0400, you wrote: Detail, detail, detail. 1. your context.xml 2. your web.xml 3. how do you obtain connection from pool, java code pls. 4. can you connect using pool 5. commons-pool version Etc. etc. You need to provide details otherwise we can't help. This was all included in my original post. Ok, actually my 2nd post because I accidentally hit send prior to completing my post via the scroll pad on my laptop. Still, thx for checking on this and the info you looking for is copied again here... System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class
Re: connection pooling
java code: Context ctx = (Context) init.lookup(xx); server.xml: ResourceParams name=xx web.xml: resource-ref res-ref-namexx/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref The entries I've labelled 'xx' should all be the same. John Thompson |-+ | | Eric Wulff | | | [EMAIL PROTECTED]| | | | | || | | 07/10/2004 10:37 | | | AM | | | Please respond to| | | Tomcat Users| | | List| | || |-+ --| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: connection pooling | --| I have gone over some of the tomcat docs and googled errors but there is SO much information covering JNDI, connection pooling, and Datasources. Can someone review the info below and consult or point me in the right direction? Although I feel I'm missing something obvious, I can't find out what's wrong with my set-up. thx Eric System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping servlet-nameTest Connection Pooling/servlet-name url-pattern/testConnectionPooling/url-pattern /servlet-mapping resource-ref res-ref-namejdbc/test_connect/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app server.xml Context: Context path=/testConnectionPooling docBase=testConnectionPooling debug=0 reloadable=true ResourceParams name=jdbc/test_connect parameter nameusername/name valueinformix/value /parameter parameter namepassword/name valueinformix/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context .java: import java.io.*; import java.sql.*; // -Must import javax.naming use JNDI which is required to implement data // resource references and hence connection pooling. import javax.naming.*; import javax.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class TestConnectionPooling extends HttpServlet { private DataSource dataSource; public void init(ServletConfig config) throws ServletException { try { Context init = new InitialContext(); // don't know what the 'java:comp/env' refers to Context ctx = (Context) init.lookup(java:comp/env); // I know jdbc/conversion must match the web.xml res-ref-name of the web.xml but don't know what the path really refers to dataSource = (DataSource) ctx.lookup(jdbc/test_connect); } catch (NamingException ex) { throw new ServletException(Cannot retrieve java:comp/env/jdbc/test_connect,ex); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Re: connection pooling
Please ignore my last post - it's wrong. (Answered before verifying). John Thompson |-+ | | Eric Wulff | | | [EMAIL PROTECTED]| | | | | || | | 07/10/2004 10:37 | | | AM | | | Please respond to| | | Tomcat Users| | | List| | || |-+ --| | | | To: [EMAIL PROTECTED] | | cc: | | Subject: connection pooling | --| I have gone over some of the tomcat docs and googled errors but there is SO much information covering JNDI, connection pooling, and Datasources. Can someone review the info below and consult or point me in the right direction? Although I feel I'm missing something obvious, I can't find out what's wrong with my set-up. thx Eric System: Tomcat 5 on Fedora Core 2 connecting to a db on an Informix Dynamic Server 9.4 on Windows Server -I am able to connect to my db via typical JDBC DriverManager.getConnection(). This leads me to believe that my informix jdbc driver is in the correct place... CATALINA_HOME/common/lib -I have a Context set up in my server.xml per examples in a text tutorial I'm referencing Below listed... -errors -web.xml -server.xml Context (minus connection actual values) -.java exception/errors: -Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null' SQL state: null Error code: 0 -stack trace reveals this, but I can't see why since I have the driver in the correct directory... java.sql.SQLException: No suitable driver at java.sql.DriverManager.getDriver(DriverManager.java:243) at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:773) web.xml: ?xml version=1.0 encoding=ISO-8859-1? !DOCTYPE web-app PUBLIC -//Sun Microsystems, Inc.//DTD Web Application 2.3//EN http://java.sun.com/dtd/web-app_2_3.dtd; web-app servlet servlet-nameTest Connection Pooling/servlet-name servlet-classTestConnectionPooling/servlet-class /servlet servlet-mapping servlet-nameTest Connection Pooling/servlet-name url-pattern/testConnectionPooling/url-pattern /servlet-mapping resource-ref res-ref-namejdbc/test_connect/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref /web-app server.xml Context: Context path=/testConnectionPooling docBase=testConnectionPooling debug=0 reloadable=true ResourceParams name=jdbc/test_connect parameter nameusername/name valueinformix/value /parameter parameter namepassword/name valueinformix/value /parameter parameter namedriverClassName/name valuecom.informix.jdbc.IfxDriver/value /parameter parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter /ResourceParams /Context .java: import java.io.*; import java.sql.*; // -Must import javax.naming use JNDI which is required to implement data // resource references and hence connection pooling. import javax.naming.*; import javax.sql.*; import javax.servlet.*; import javax.servlet.http.*; import java.util.*; public class TestConnectionPooling extends HttpServlet { private DataSource dataSource; public void init(ServletConfig config) throws ServletException { try { Context init = new InitialContext(); // don't know what the 'java:comp/env' refers to Context ctx = (Context) init.lookup(java:comp/env); // I know jdbc/conversion must match the web.xml res-ref-name of the web.xml but don't know what the path really refers to dataSource = (DataSource) ctx.lookup(jdbc/test_connect); } catch (NamingException ex) { throw new ServletException(Cannot retrieve java:comp/env/jdbc/test_connect,ex); } } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { response.setContentType(text/html); PrintWriter out = response.getWriter(); Connection connection = null; out.println (HTMLHEADTITLETest Connection Pooling/TITLE/HEADBODY); out.println(H1Customer Name Query/H1); try {
Re: connection pooling
parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter Is that litterally what you have in your server.xml? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
No, literally I have the actual values. The same connection string I use to successfully connect via JDBC using DriverMangager.getConnection() minus the user and passoword. Eric On Thu, 7 Oct 2004 11:04:22 +1300, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: parameter nameurl/name valuejdbc:informix-sqli://url:port/dbName:INFORMIXSERVER=serverName/value /parameter Is that litterally what you have in your server.xml? - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
Is there a x.xml file in (TOMCAT_HOME)/conf/Catalina/localhost, where xx is the context name? (this is an independent context configuration that may have been created independently when you first deployed your application on Tomcat). If so, either delete it, or move your data source definition out of server.xml and into this file (remove the entire context from server.xml). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
Context name? I assume your referring to the ResourceParams name attribute, jdbc/test_connect in this case, from the Context declaration in my server.xml. So, I'd be looking for a test_connect.xml. There are NO .xml files in the TOMCAT_HOME/conf/Catalina/localhost with this name or any name which seems to refer to my app. There are 3 .xmls there... an admin.xml, manager.xml, and a balancer.xml which is somehow related to an example app provided by the installation. I had checked for this thinking there would be, and perhaps should be, a .xml such as you stated. You've at least eliminated a possible cause to my dilemma. Eric On Thu, 7 Oct 2004 11:29:38 +1300, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Is there a x.xml file in (TOMCAT_HOME)/conf/Catalina/localhost, where xx is the context name? (this is an independent context configuration that may have been created independently when you first deployed your application on Tomcat). If so, either delete it, or move your data source definition out of server.xml and into this file (remove the entire context from server.xml). - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling problem
I am using these parameters : for Connection pooling... in Tomcat 4.1 maxActive :20 maxIdle :10 mxWait :1 removeAbandoned :true My application makes 5 queries to the database at one time, so it calls datasource.getConnection 5 times and closes connection 5 times.. When i run this application 3 times in a loop, it fails with the exception of org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted, cause: java.util.NoSuchElementException: Timeout waiting for idle object at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPoo l.java:801) I still don't understand, whether connection pool is being used... can someone suggest me what exactly i am missing here... --- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection pooling and multiple dbs
Hi, One pool = one database. It's not a Tomcat limitation per se, it's a limitation of the connection pool implementation (I'm guessing you use DBCP), which in turn comes from the way javax.sql is designed. However, you can define as many pools as you want in Tomcat, so just define one for each DB. Yoav Shapira Millennium Research Informatics -Original Message- From: Michael J. Makunas [mailto:[EMAIL PROTECTED] Sent: Thursday, September 16, 2004 2:25 AM To: [EMAIL PROTECTED] Subject: Connection pooling and multiple dbs I currently have a system where we're using Tomcat's db connection pooling (with MySql). We're still having db performance issues so we're considering having multiple instances of our db. Is there a way to set up Tomcat to use a pool that connects to multiple dbs (assuming, for now, that keeping db instances in sync isn't a problem)? -Michael -- ** Michael J. Makunas ** http://www.makunas.com/ ** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection pooling with two databases
Frans I use dbcp to pool two different databases on different servers. A mysql on localhost and an Oracle on a remote host. I have never had a problem. I define my pools in my webapp.xml so they are specifically restricted to the app that uses them. I would examine your dataSourceName and understand how this value affects which database the query gets given to. You might try making the dsnames differ for more than one charater. The other thing that comes to mind is if you are running some sort of query object/layer in between the pool and your object model. If you reuse an object like this you might get crosstalk. The other question that I would ask would be if the error happens within the same session or across sessions. If it happens across sessions then you are storing a reference to a connection in an instance var in a servlet (a major No No). I know these are vague... Hope this points you toward a solution. Regards Michael -Original Message- From: Frans Flippo [mailto:[EMAIL PROTECTED] Sent: Tuesday, June 29, 2004 10:58 AM To: [EMAIL PROTECTED] Subject: Connection pooling with two databases Hi, We're using Tomcat 4.1.30 and PostgreSQL 7.3.4 to run a high-volume website. We connect to two different databases using database connection pooling and occasionally a mixup seems to occur where a query intended for database A is executed on database B, or vice versa. Postgres says Relation 'xxx' does not exist and the database log shows a query being executed on a Postgres instance that previously connected to the 'wrong' database. It looks like the JNDI lookup is returning the wrong DataSource object. The strange thing is most of the time it works fine. We've run for 3 weeks without a problem; then just yesterday it happened twice in a row. A Tomcat restart 'fixes' it, but of course we'd rather avoid that. Has anybody used _two_ databases in a single web application using connection pooling? Is it something that should be supported? Does this seem like a problem in Tomcat, the commons dbcp/pooling code, or the Postgres jdbc driver? Thanks in advance for anything that could point us in the right direction. Regards, Frans Here's the code we use to lookup the DataSource and obtain the Connection. The code is in a method that gets executed twice, with a different dataSourceName parameter each time (db1 and db2). -== ==- import javax.naming.Context; import javax.naming.InitialContext; import javax.sql.DataSource; import java.sql.Connection; . . . DataSource dataSource; Connection connection; Context initialContext = new InitialContext(); Context envContext = (Context)initialContext.lookup(java:/comp/env); dataSource = (DataSource)envContext.lookup(dataSourceName); connection = dataSource.getConnection(); -== ==- Here's the Resources we define in the DefaultContext section of server.xml: -== ==- Resource name=jdbc/db1 auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/db1 parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueorg.postgresql.Driver/value /parameter parameter nameurl/name valuejdbc:postgresql://127.0.0.1:5432/db1/value /parameter parameter nameusername/name valuepostgres/value /parameter parameter namepassword/name value/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter /ResourceParams Resource name=jdbc/db2 auth=Container type=javax.sql.DataSource/ ResourceParams name=jdbc/db2 parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueorg.postgresql.Driver/value /parameter parameter nameurl/name valuejdbc:postgresql://127.0.0.1:5432/db2/value /parameter parameter nameusername/name valuepostgres/value /parameter parameter namepassword/name value/value /parameter parameter
Re: Connection pooling -- Hello Doug
Hello Doug 1- My ROOt.xml doesn't have any error.That problem caused by wrong copy and paste. 2- I changed the order of Parameters in Resource tag but wasn't useful. 3- Look, I don't see any error message.When I check the number of connection in Mysqladmin, in 4.1.18 the number of connection doesn't rise quickliy but in 5.0.19 for each open page we have a distinct connection. 4- I think this problem caused by Common-pool-1.1 and Common-dbcp-1.1 jar files,because in 4.1.30 that have the same jar files you also see that problem. 5- A test,if you copy thoes jar files in 4.1.18 and rename them, connection pooling doesn't work such as 4.1.30 and 5.0.9 without any error message. 6 - And another test, my java file is like this : package pooling; import javax.sql.*; import javax.naming.*; import java.sql.*; public class webPooling { Connection mySqlConnection = null; public webPooling() //Class constructor { } public void init() //Connection Creator { try { Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(ERROR IN CONTEXT INITIALIZATION!!?); DataSource mySqlDatasource = (DataSource)ctx.lookup (java:comp/env/jdbc/UKwebpooling); if(mySqlDatasource == null) throw new Exception (ERROR IN DATASOURCE CREATING); else mySqlConnection = mySqlDatasource.getConnection(); }//try catch(Exception e) { e.printStackTrace(); } } public Connection getConnection() { return mySqlConnection; } } if you add this code to the end of this java file : public void closeConnection() { try { if(!mySqlConnection.isClosed()) mySqlConnection.close(); } catch(Exception ex) { System.out.println(ERROR IN CLOSING THE CONNECTION (POOL)); ex.printStackTrace(); } } and call this method in your Jsp file, in 4.1.18 you don't see any error message and Connection pooling works so good, but in 5.0.19 you see this error message: Connection is already closed. . and so many Exceptions. 8- If you create a Statement in java file, that error message doesn't appear. What is your idea? With thanks. masood. - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢
Re: Connection pooling
Is this a direct cut and paste? If yes you are missing a at the end of the Logger. Otherwise watch the order of the elements in the Resource. It can make a difference in some cases. What are the errors? What does the web.xml look like? Doug www.parsonstechnical.com - Original Message - From: Masood Reyhanei Hamedani [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, April 22, 2004 8:01 AM Subject: Connection pooling Dear all I have a problem in using Connection Pooling with Tomcat 5.0.19, that is working in version 4.1.18 so good.I am using that configuration with 5.0.19 but it doesn't work att all. I configure the ROOT.xml in this way: ?xml version='1.0' encoding='utf-8'? Context cachingAllowed=true crossContext=true debug=0 docBase=/ROOT path= privileged=false reloadable=true swallowOutput=false useNaming=true Logger className=org.apache.catalina.logger.FileLogger debug=0 directory=logs prefix=localhost_ROOT_log. suffix=.txt timestamp=true verbosity=1/ Resource auth=Container name=jdbc/UKwebpooling scope=Shareable type=javax.sql.DataSource/ ResourceParams name=jdbc/UKwebpooling parameter nameurl/name valuejdbc:mysql://localhost/university?autoReconnect=true/value /parameter parameter namedriverClassName/name valuecom.mysql.jdbc.Driver/value /parameter parameter nameusername/name valuemyusername/value /parameter parameter namepassword/name valuemypassword/value /parameter parameter namemaxIdle/name value0/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxWait/name value-1/value /parameter parameter nameremoveAbandoned/name valuetrue/value /parameter parameter namelogAbandoned/name valuetrue/value /parameter parameter nameremoveAbandonedTimeout/name value60/value /parameter parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter /ResourceParams /Context and create a java class such as this: package pooling; import javax.sql.*; import javax.naming.*; import java.sql.*; public class webPooling { Connection mySqlConnection = null; public webPooling() //Class constructor { } public void init() //Connection Creator { try { Context ctx = new InitialContext(); if(ctx == null ) throw new Exception(ERROR IN CONTEXT INITIALIZATION!!?); DataSource mySqlDatasource = (DataSource)ctx.lookup(java:comp/env/jdbc/UKwebpooling); if(mySqlDatasource == null) throw new Exception (ERROR IN DATASOURCE CREATING); else mySqlConnection = mySqlDatasource.getConnection(); }//try catch(Exception e) { e.printStackTrace(); } } public Connection getConnection() { return mySqlConnection; } } I guess the problem is in common-dbcp-1.1 and common-pool-1.1 .jar files . Is there any one that know about this problem? With Thanks. Masood. - Do you Yahoo!? Yahoo! Photos: High-quality 4x6 digital prints for 25¢ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling
I can't remember the specifics off hand, but... There is a mechanism in DBCP that allows you to check a connection with a validationQuery (use this term when googling for it!) that can be run a) every now and then on an idle connection (very useful if a firewall sits in the middle) b) before returning the connection to the application. c) ??? (Maybe in other cases, I can't remember. I am not sure what happens in (b) if the validation query fails. What I think it should do is open a new connection (or pick another one from the pool if possible) and return it to the application after validation. If it fails in (a), it simply drops the connection, AFAIK. So when asking for a new one, a new one is established. Please google for details. Yours, Antonio Fiol Peter Choe wrote: i am using connection pooling with tomcat 4.10. i am using postgresql and oracle database for various web application. when either of the databases restart, tomcat can't reconnect to the database and it needs to be restarted. i know that mysql has a autoreconnect to re-establish connection. how can i do this for postgresql and if anyone knows off hand, for oracle. peter choe - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] smime.p7s Description: S/MIME Cryptographic Signature
RE: Connection pooling and Oracle connection in server.xml
Hi, Why auth=SERVLET and not CONTAINER if you're supplying the username/password in server.xml? Did you search the list archives about this topic before posting? Yoav Shapira Millennium Research Informatics -Original Message- From: prasad chaturvedula [mailto:[EMAIL PROTECTED] Sent: Thursday, April 08, 2004 10:45 AM To: [EMAIL PROTECTED] Subject: Connection pooling and Oracle connection in server.xml Hi guys, I have a problem with connecting to oracle db using the commons dbcp connection pooling. Here is teh content of my server.xml file-- /ResourceParams Resource name=jdbc/myoracle auth=SERVLET type=javax.sql.DataSource/ ResourceParams name=jdbc/myoracle parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namedriverClassName/name valueoracle.jdbc.driver.OracleDriver/value /parameter parameter nameurl/name valuejdbc:oracle:thin:[EMAIL PROTECTED]:1521:apt/value /parameter parameter nameusername/name valueapthrdb/value /parameter parameter namepassword/name valueapthrdb/value /parameter parameter namemaxActive/name value20/value /parameter parameter namemaxIdle/name value10/value /parameter parameter namemaxWait/name value-1/value /parameter /ResourceParams and here is teh content of my web.xml-- resource-ref descriptionOracle Datasource example/description res-ref-namejdbc/myoracle/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref This is in $MY_CONTEXT/WEB-INF/web.xml. I am getting teh following error message while trying to execute a db query from my jso page- I am at1 I am at2 I am here I am here I am here I am here I am here java.sql.SQLException: Cannot load JDBC driver class 'null' at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSourc e.ja va:529) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.j ava: 312) at aptransco.hrd.Testdb.getTestdb(Testdb.java:32) at org.apache.jsp.testdb_jsp._jspService(testdb_jsp.java:53) at org.apache.jasper.runtime.HttpJspBase.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.jasper.servlet.JspServletWrapper.service(Unknown Source) at org.apache.jasper.servlet.JspServlet.serviceJspFile(Unknown Source) at org.apache.jasper.servlet.JspServlet.service(Unknown Source) at javax.servlet.http.HttpServlet.service(HttpServlet.java) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Unknow n Source) at org.apache.catalina.core.ApplicationFilterChain.doFilter(Unknown Source) at org.apache.catalina.core.StandardWrapperValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContextValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardContext.invoke(Unknown Source) at org.apache.catalina.core.StandardHostValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.valves.ErrorDispatcherValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.valves.ErrorReportValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at org.apache.catalina.core.StandardEngineValve.invoke(Unknown Source) at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext. invo keNext(Unknown Source) at org.apache.catalina.core.StandardPipeline.invoke(Unknown Source) at org.apache.catalina.core.ContainerBase.invoke(Unknown Source) at
RE: Connection Pooling
Justin, The DBCP that's bundled with Tomcat as well as most other pools (proxool for one) return a java.sql.Connection implementation class that wraps the actual DB driver java.sql.Connection implementation. Calling close() on the Connection that you got from the pool returns the underlying connection to the pool for reuse. For DBCP, if you don't call close(), the connection is eventually considered abandoned, and there are a few configuration parameters that affect what happens at that point. http://jakarta.apache.org/commons/dbcp/ for details. -john. -Original Message- From: James Neville [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 11:51 AM To: Tomcat Users List Subject: Re: Connection Pooling Justin, That would all depend on the pooling implementation you're using. Commonly, its pool.free(conn) or pool.freeConnection(conn). Remember *not* to close the connection if you're using connection pooling, as this should be handled by the pool itself. That said one of my colleagues mentioned one pooling implementation he used that returned a custom connection object when obtained from the pool (ie not a java.sql Connection object). The close() method on that connection returned it to the pool, but *didn't* actually close it. If you let us know which pooling implementation you're using, it may make things clearer ;) Cheers, James Hart, Justin wrote: Is there some manner in which a database connection should be returned to the connection pool, or is that automatic? Justin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling
I believe when you close the connection, which should be added in a finally block eg. } finally { try { oConn.close(); } catch (Exception ex) { // Can't recovery gracefully, do nothing } } -Art -Original Message- From: Hart, Justin [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 07, 2004 11:51 AM To: [EMAIL PROTECTED] Subject: Connection Pooling Is there some manner in which a database connection should be returned to the connection pool, or is that automatic? Justin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Pooling
Justin, That would all depend on the pooling implementation you're using. Commonly, its pool.free(conn) or pool.freeConnection(conn). Remember *not* to close the connection if you're using connection pooling, as this should be handled by the pool itself. That said one of my colleagues mentioned one pooling implementation he used that returned a custom connection object when obtained from the pool (ie not a java.sql Connection object). The close() method on that connection returned it to the pool, but *didn't* actually close it. If you let us know which pooling implementation you're using, it may make things clearer ;) Cheers, James Hart, Justin wrote: Is there some manner in which a database connection should be returned to the connection pool, or is that automatic? Justin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling
Usually every databse has its own ConnectionPool implementation. -- De: James Neville[SMTP:[EMAIL PROTECTED] Responder:Tomcat Users List Enviada: quarta-feira, 7 de janeiro de 2004 13:50 Para: Tomcat Users List Assunto: Re: Connection Pooling Justin, That would all depend on the pooling implementation you're using. Commonly, its pool.free(conn) or pool.freeConnection(conn). Remember *not* to close the connection if you're using connection pooling, as this should be handled by the pool itself. That said one of my colleagues mentioned one pooling implementation he used that returned a custom connection object when obtained from the pool (ie not a java.sql Connection object). The close() method on that connection returned it to the pool, but *didn't* actually close it. If you let us know which pooling implementation you're using, it may make things clearer ;) Cheers, James Hart, Justin wrote: Is there some manner in which a database connection should be returned to the connection pool, or is that automatic? Justin - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Pooling in Tomcat 4.0
I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question is It is likely to put Database(SqL Server in our case) credential like DSN,USER,PASSWORD in either web.xml or server.xml, which we don;t want to hard code as it is already present in configuration file. So how i can avoid writing SQL Server credential in web.xml Thanks in advance Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling in Tomcat 4.0
Hi Andoni, Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. Hi andoni, First of all thanks for reply. Because you have already done this configaration, Do we need to put Database user id and Password in the server.xml file. if yes what other thing we need to put in server.xml and what things we need to put in web.xml Thanks a lot.. Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is highly welcome -Santosh -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:27 PM To: Tomcat Users List Subject: Re: Connection Pooling in Tomcat 4.0 I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question is It is likely to put Database(SqL Server in our case) credential like DSN,USER,PASSWORD in either web.xml or server.xml, which we don;t want to hard code as it is already present in configuration file. So how i can avoid writing SQL Server credential in web.xml Thanks in advance Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling in Tomcat 4.0
Hi andoni, First of all thanks for reply. Because you have already done this configaration, Do we need to put Database user id and Password in the server.xml file. if yes what other thing we need to put in server.xml and what things we need to put in web.xml Thanks a lot.. Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is highly welcome -Santosh -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:27 PM To: Tomcat Users List Subject: Re: Connection Pooling in Tomcat 4.0 I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question is It is likely to put Database(SqL Server in our case) credential like DSN,USER,PASSWORD in either web.xml or server.xml, which we don;t want to hard code as it is already present in configuration file. So how i can avoid writing SQL Server credential in web.xml Thanks in advance Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Vedr.: RE: Connection Pooling in Tomcat 4.0
Hi santosh. I have been using DBConnectionBroker from http://www.javaexchange.com/ with Tomcat 4.03 and am currently using it with Tomcat 4.1.27. I have no clue what so ever about its performance etc. vs. DBCP but found it very easy to configure and use as I had no experience with connection pooling. Best regards Thomas [EMAIL PROTECTED] 16-09-03 14:13 Besvar venligst til Tomcat Users List Til:[EMAIL PROTECTED] cc: [EMAIL PROTECTED] Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi andoni, First of all thanks for reply. Because you have already done this configaration, Do we need to put Database user id and Password in the server.xml file. if yes what other thing we need to put in server.xml and what things we need to put in web.xml Thanks a lot.. Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is highly welcome -Santosh -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:27 PM To: Tomcat Users List Subject: Re: Connection Pooling in Tomcat 4.0 I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question is It is likely to put Database(SqL Server in our case) credential like DSN,USER,PASSWORD in either web.xml or server.xml, which we don;t want to hard code as it is already present in configuration file. So how i can avoid writing SQL Server credential in web.xml Thanks in advance Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=Arial___ Vi goer opmaerksom paa, at denne e-mail kan indeholde fortrolig information. Hvis du ved en fejltagelse modtager e-mailen, beder vi dig venligst informere afsender om fejlen ved at bruge svar-funktionen. Samtidig beder vi dig slette e-mailen i dit system uden at videresende eller kopiere den. Selv om e-mailen og ethvert vedhaeftet bilag efter vores overbevisning er fri for virus og andre fejl, som kan paavirke computeren eller it-systemet, hvori den modtages og laeses, aabnes den paa modtagerens eget ansvar. Vi paatager os ikke noget ansvar for tab og skade, som er
RE: Vedr.: RE: Connection Pooling in Tomcat 4.0
Hi Thomas, As you have used DBConnectionBroker, can you tell me what configuration is required,whatso ever and the second question i want to ask is if it is free. Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. -Original Message- From: Thomas Nybro Bolding [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:47 PM To: Tomcat Users List Subject: Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi santosh. I have been using DBConnectionBroker from http://www.javaexchange.com/ with Tomcat 4.03 and am currently using it with Tomcat 4.1.27. I have no clue what so ever about its performance etc. vs. DBCP but found it very easy to configure and use as I had no experience with connection pooling. Best regards Thomas [EMAIL PROTECTED] 16-09-03 14:13 Besvar venligst til Tomcat Users List Til:[EMAIL PROTECTED] cc: [EMAIL PROTECTED] Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi andoni, First of all thanks for reply. Because you have already done this configaration, Do we need to put Database user id and Password in the server.xml file. if yes what other thing we need to put in server.xml and what things we need to put in web.xml Thanks a lot.. Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is highly welcome -Santosh -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:27 PM To: Tomcat Users List Subject: Re: Connection Pooling in Tomcat 4.0 I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question is It is likely to put Database(SqL Server in our case) credential like DSN,USER,PASSWORD in either web.xml or server.xml, which we don;t want to hard code as it is already present in configuration file. So how i can avoid writing SQL Server credential in web.xml Thanks in advance Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] FONT SIZE=1 FACE=Arial___ Vi goer opmaerksom paa, at denne e-mail kan indeholde
Vedr.: RE: Vedr.: RE: Connection Pooling in Tomcat 4.0
The way I have done it (though this might not be the best...) is this: i) Copied the DBConnectionBroker.class file to Web-inf/classes/com/javaexchange/dbConnectionBroker ii) I have an initializing method being called from JspInit() such as this: package com.db.regnskab; import com.javaexchange.dbConnectionBroker.*; public class IRUtilities { public static DbConnectionBroker dbBroker; public static void init() { try { String driver = sun.jdbc.odbc.JdbcOdbcDriver; String url= jdbc:odbc:dmir; String logfile= D:\\DAT\\logfiles\\connections\\regnskab.log; dbBroker = new DbConnectionBroker(driver, url, foo, bar, 50, 100, logfile, 0.01); } catch(IOException e) { e.printStackTrace(); } } } The syntax can be seen in the documentation but essentially this gives me 5 initial connection using the specified odbc-driver. Please note userid and password are supplied within the class but may just as well be parsed. iii)When I need a connection I simply use it in my classes such as this: package com.db.regnskab; import com.javaexchange.dbConnectionBroker.*; public class Afstemning { public static void arkiverAfstemning() { DbConnectionBroker dbBroker = IRUtilities.dbBroker; Connection conn = dbBroker.getConnection(); try { /*some sql...*/ } catch(Exception e) { e.printStackTrace(); } finally { dbBroker.freeConnection(conn); } } The answer to your second answer is YES - it is written and distributed under Open Source License. /Thomas [EMAIL PROTECTED] 16-09-03 14:42 Til:[EMAIL PROTECTED] cc: Thomas Nybro Bolding/THBO/Intranet/[EMAIL PROTECTED] Vedr.: RE: Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi Thomas, As you have used DBConnectionBroker, can you tell me what configuration is required,whatso ever and the second question i want to ask is if it is free. Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. -Original Message- From: Thomas Nybro Bolding [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:47 PM To: Tomcat Users List Subject: Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi santosh. I have been using DBConnectionBroker from http://www.javaexchange.com/ with Tomcat 4.03 and am currently using it with Tomcat 4.1.27. I have no clue what so ever about its performance etc. vs. DBCP but found it very easy to configure and use as I had no experience with connection pooling. Best regards Thomas [EMAIL PROTECTED] 16-09-03 14:13 Besvar venligst til Tomcat Users List Til:[EMAIL PROTECTED] cc: [EMAIL PROTECTED] Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi andoni, First of all thanks for reply. Because you have already done this configaration, Do we need to put Database user id and Password in the server.xml file. if yes what other thing we need to put in server.xml and what things we need to put in web.xml Thanks a lot.. Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is highly welcome -Santosh -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:27 PM To: Tomcat Users List Subject: Re: Connection Pooling in Tomcat 4.0 I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question is It is likely to put Database(SqL Server in our case) credential like DSN,USER,PASSWORD in either web.xml or server.xml, which we don;t want to hard code as it is already present in configuration file. So how i can avoid writing SQL Server credential in web.xml Thanks in advance Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should
RE: Vedr.: RE: Vedr.: RE: Connection Pooling in Tomcat 4.0
Hi Thomas, Thanks a lot for all your help, I will check it out and will revert back in case of problem. Thanks a lot once again. Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. -Original Message- From: Thomas Nybro Bolding [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 6:33 PM To: Santosh Bhushan-OP Cc: [EMAIL PROTECTED] Subject: Vedr.: RE: Vedr.: RE: Connection Pooling in Tomcat 4.0 The way I have done it (though this might not be the best...) is this: i) Copied the DBConnectionBroker.class file to Web-inf/classes/com/javaexchange/dbConnectionBroker ii) I have an initializing method being called from JspInit() such as this: package com.db.regnskab; import com.javaexchange.dbConnectionBroker.*; public class IRUtilities { public static DbConnectionBroker dbBroker; public static void init() { try { String driver= sun.jdbc.odbc.JdbcOdbcDriver; String url= jdbc:odbc:dmir; String logfile= D:\\DAT\\logfiles\\connections\\regnskab.log; dbBroker = new DbConnectionBroker(driver, url, foo, bar, 50, 100, logfile, 0.01); } catch(IOException e) { e.printStackTrace(); } } } The syntax can be seen in the documentation but essentially this gives me 5 initial connection using the specified odbc-driver. Please note userid and password are supplied within the class but may just as well be parsed. iii)When I need a connection I simply use it in my classes such as this: package com.db.regnskab; import com.javaexchange.dbConnectionBroker.*; public class Afstemning { public static void arkiverAfstemning() { DbConnectionBroker dbBroker = IRUtilities.dbBroker; Connection conn = dbBroker.getConnection(); try { /*some sql...*/ } catch(Exception e) { e.printStackTrace(); } finally { dbBroker.freeConnection(conn); } } The answer to your second answer is YES - it is written and distributed under Open Source License. /Thomas [EMAIL PROTECTED] 16-09-03 14:42 Til:[EMAIL PROTECTED] cc:Thomas Nybro Bolding/THBO/Intranet/[EMAIL PROTECTED] Vedr.:RE: Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi Thomas, As you have used DBConnectionBroker, can you tell me what configuration is required,whatso ever and the second question i want to ask is if it is free. Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. -Original Message- From: Thomas Nybro Bolding [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:47 PM To: Tomcat Users List Subject: Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi santosh. I have been using DBConnectionBroker from http://www.javaexchange.com/ with Tomcat 4.03 and am currently using it with Tomcat 4.1.27. I have no clue what so ever about its performance etc. vs. DBCP but found it very easy to configure and use as I had no experience with connection pooling. Best regards Thomas [EMAIL PROTECTED] 16-09-03 14:13 Besvar venligst til Tomcat Users List Til:[EMAIL PROTECTED] cc: [EMAIL PROTECTED] Vedr.: RE: Connection Pooling in Tomcat 4.0 Hi andoni, First of all thanks for reply. Because you have already done this configaration, Do we need to put Database user id and Password in the server.xml file. if yes what other thing we need to put in server.xml and what things we need to put in web.xml Thanks a lot.. Any other suggestion regarding using CONNECTION POOLING WITH TOMCAT 4.0 is highly welcome -Santosh -Original Message- From: Andoni [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 5:27 PM To: Tomcat Users List Subject: Re: Connection Pooling in Tomcat 4.0 I have tried this and ended up using the DBCP package that comes with Tomcat 4.1. It is not part of Tomcat 4.1 thought so you can download it separately and use it with Tomcat 4.0.4 or later (I hope you have these). Tyrex is not the most useful of things and is major hassle to get working. You can download the DBCP package from here: http://jakarta.apache.org/commons/index.html You need to download DBCP, Collections Pool From there it's easy just put the necessary bits in your server.xml (yes I think this is unavoidable) and it works a treat. Hope that helps, Andoni. - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 12:27 PM Subject: Connection Pooling in Tomcat 4.0 Hi, Can anyone send me the process of using Connection pooling in Tomcat 4.0 I have gone through Tomcat documentation, it says it can be done using Tyrex.jar file. Can anyone send me the process. The second question
Re: Connection Pooling
look at the docs - Original Message - From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 9:06 PM Subject: Connection Pooling Hi All, Can anybody send me the configuration for DBCP Connection pooling with TOmcat 4.0 Regards, Santosh Bhushan i-flex solutions ltd. Tel:2086013 Where there is will there is a way and everything is possible for a willing heart. -Original Message- From: Yann Cébron [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 8:33 PM To: [EMAIL PROTECTED] Subject: Re: error when starting tomcat Hello, Hello. in my linux i start the tomcat and appears this error: can anybody helps me for solving it? thnaks Sep 16, 2003 1:07:14 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true Sep 16, 2003 1:07:14 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true Sep 16, 2003 1:07:15 PM org.apache.struts.util.PropertyMessageResources init INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true Sep 16, 2003 1:07:18 PM org.apache.jk.common.ChannelSocket init INFO: JK2: ajp13 listening on /0.0.0.0:8009 Sep 16, 2003 1:07:18 PM org.apache.jk.server.JkMain start INFO: Jk running ID=0 time=4/38 config=/opt/jakarta/tomcat/conf/jk2.properties don't worry, that's just INFOrmation messages from Tomcat resp. the admin-webapp starting up. As long as you don't get any WARN oder ERROR messages, everything is allright. Yann - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] DISCLAIMER: This message contains privileged and confidential information and is intended only for the individual named.If you are not the intended recipient you should not disseminate,distribute,store,print, copy or deliver this message.Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted,corrupted,lost,destroyed,arrive late or incomplete or contain viruses.The sender therefore does not accept liability for any errors or omissions in the contents of this message which arise as a result of e-mail transmission. If verification is required please request a hard-copy version. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection Pooling HELP
Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
I found out you also need the commom-pool.jar file also. Why does Tomcat provide Connection Pooling but doesn't distribute all necessary files to do so with the Binary release? These 2 jar files are not specific to the database, so you would think Tomcat would come with them. Not to mention Tomcats docs don't mention the fact that you need to download them. G! Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:45 PM To: 'Tomcat Users List'; 'Tomcat Users List' Subject: RE: Connection Pooling HELP You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
Simple solution, don't use the LE version. Use the full version. Your problems will disappear. -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 2:07 PM To: 'Tomcat Users List' Subject: RE: Connection Pooling HELP I found out you also need the commom-pool.jar file also. Why does Tomcat provide Connection Pooling but doesn't distribute all necessary files to do so with the Binary release? These 2 jar files are not specific to the database, so you would think Tomcat would come with them. Not to mention Tomcats docs don't mention the fact that you need to download them. G! Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:45 PM To: 'Tomcat Users List'; 'Tomcat Users List' Subject: RE: Connection Pooling HELP You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling HELP
Thanks. But if this is the case, the download documentation might need some updating. The documentation used to specify that if you have JDK 1.4.x you only needed the LE version. It said nothing about commons jar files. And now, I can't find anything anywhere that specifies which one you should get. But thanks for the heads-up. ;) Gregg -Original Message- From: Angus Mezick [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 1:18 PM To: Tomcat Users List Subject: RE: Connection Pooling HELP Simple solution, don't use the LE version. Use the full version. Your problems will disappear. -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 2:07 PM To: 'Tomcat Users List' Subject: RE: Connection Pooling HELP I found out you also need the commom-pool.jar file also. Why does Tomcat provide Connection Pooling but doesn't distribute all necessary files to do so with the Binary release? These 2 jar files are not specific to the database, so you would think Tomcat would come with them. Not to mention Tomcats docs don't mention the fact that you need to download them. G! Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:45 PM To: 'Tomcat Users List'; 'Tomcat Users List' Subject: RE: Connection Pooling HELP You might be right. I don't have the commons-dbpc.jar file. Why isn't this included with the Binary release of Tomcat and where can I get it? I can't find it with all the other Commons downloads. Thanks Gregg -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2003 12:40 PM To: Tomcat Users List Subject: Re: Connection Pooling HELP Gregg Bolinger wrote: I am trying to get connection pooling working with Tomcat 4.1.24-LE. Below is some relevant code. Tomcat starts up just fine. I have all my JAR files I need in the right place. If I create my own connection using JDBC it all works just fine. But using a connection pool is failing. The error message is after all the code. [...] And I get this error message javax.naming.NamingException: Cannot create resource instance at org.apache.naming.factory.ResourceFactory.getObjectInstance(ResourceF actory.java:189) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:3 01) at org.apache.naming.NamingContext.lookup(NamingContext.java:834) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:181) at org.apache.naming.NamingContext.lookup(NamingContext.java:822) at org.apache.naming.NamingContext.lookup(NamingContext.java:194) at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183) at javax.naming.InitialContext.lookup(InitialContext.java:347) at AddReference.processRequest(AddReference.java:65) at AddReference.doPost(AddReference.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) This may not help, but I have heard of this happening when some needed .jars were missing from CATALINA_HOME/common/lib - in particular, commons-dbcp.jar and commons-pool.jar. -- Lynn Hollerman. - 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling
Ok, got that resolved. I just had the element order in my web.xml file wrong. Of course now I am getting this error: cannot create resource instance So I am off to research that. Gregg -Original Message- From: Gregg Bolinger [mailto:[EMAIL PROTECTED] Sent: Saturday, August 02, 2003 10:06 PM To: [EMAIL PROTECTED] Subject: Connection Pooling I am trying to setup MySQL connection pooling in Tomcat 4.1.24 and when I try and add resource-ref descriptionDB Connection/description res-ref-namejdbc/TestDB/res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref to my web.xml file, it complains that resource-ref is not allowed as a web-app element. Is the documentation accurate? Or am I missing something? Link the documentation I am referring to is here: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples -howto.html thanks Gregg - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling and server.xml
Bill2 wrote: I am using Tomcat 4.0.4, MySQL Max 3.23.51 on Linux 7.2 and mysql-connector-java-3.0.8-stable-bin.jar. I got it to work in my development environment NetBeans 3.5, but when I put it on the production server by changing the server.xml file as instructed at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/printer/jndi-datasource-examples-howto.html#MySQL%20DBCP%20Example Tomcat doesn't even start. I have looked in the log files for startup errors, server.xml parsing errors, etc. but can't find any. Any ideas on what is going wrong or how to figure out what it doesn't like about the server.xml file? I'm not familiar with NetBeans, but can you verify that Tomcat is indeed running in both environments - say without pooling? When you try to start it in production, is anything happening to your catalina.out file? -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling - how to verify it's in use
I had a problem like this. I had an application that didn't use connection pooling and i was converting it over. In Windows is used the netstat command with the auto repeat option. It shows all of the active network connections and i watched the list et shorter as components where switched over. hope this helps At 09:32 AM 7/2/2003 -0500, you wrote: I have a question about connection pooling I can't seem to answer after reading the Tomcat FAQ or either JNDI HOW-TO. I'm using TC 4.1.24 and have followed all the instructions on setting up a connection pool thru Tomcat for an application (this one uses an EDBC driver) - and I can see how I can verify that it gets a connection to the database. But I'm not sure just how to tell that it's using a connection pool(I've been known to screw-up in reverse); is there some setting in server.xml that would allow me to see that the connections are using a pool? Thanks! -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.491 / Virus Database: 290 - Release Date: 6/18/2003 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.491 / Virus Database: 290 - Release Date: 6/18/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling - how to verify it's in use
Are you trying to see the (total connections available -- total connections used) info? -Original Message- From: Christopher Prince [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 10:54 AM To: Tomcat Users List Subject: Re: connection pooling - how to verify it's in use I had a problem like this. I had an application that didn't use connection pooling and i was converting it over. In Windows is used the netstat command with the auto repeat option. It shows all of the active network connections and i watched the list et shorter as components where switched over. hope this helps At 09:32 AM 7/2/2003 -0500, you wrote: I have a question about connection pooling I can't seem to answer after reading the Tomcat FAQ or either JNDI HOW-TO. I'm using TC 4.1.24 and have followed all the instructions on setting up a connection pool thru Tomcat for an application (this one uses an EDBC driver) - and I can see how I can verify that it gets a connection to the database. But I'm not sure just how to tell that it's using a connection pool(I've been known to screw-up in reverse); is there some setting in server.xml that would allow me to see that the connections are using a pool? Thanks! -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.491 / Virus Database: 290 - Release Date: 6/18/2003 - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling - how to verify it's in use
Gregory, Carlton wrote: Are you trying to see the (total connections available -- total connections used) info? No. All I want to do is be able to show someone that connection pooling is indeed being used, rather than what we've been using to connect to a database. I can have a message printed out that a connection has been made, sure, but that doesn't prove that the I'm actually doing connection pooling. I was thinking perhaps there was an entry made in, say, catalina.out if some setting were altered? -- Lynn Hollerman. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: connection pooling - how to verify it's in use
Nope :( (It's on my wish list too) But DBCP is used as the connection pooling machanism. So when you get your datasource - just cast it the the appropriate DBCP class and get your stats. http://jakarta.apache.org/commons/dbcp/ -Tim Geralyn M Hollerman wrote: I have a question about connection pooling I can't seem to answer after reading the Tomcat FAQ or either JNDI HOW-TO. I'm using TC 4.1.24 and have followed all the instructions on setting up a connection pool thru Tomcat for an application (this one uses an EDBC driver) - and I can see how I can verify that it gets a connection to the database. But I'm not sure just how to tell that it's using a connection pool(I've been known to screw-up in reverse); is there some setting in server.xml that would allow me to see that the connections are using a pool? Thanks! - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling
Thanks for answering my question. You are saying you can set a validation query to validate connections. Can you set a specific time intervals for this validation to be done and where do you do it? Is there a documentation on how to do this? I should mention we are using Tomcat 4.0.x, can I use DBCP? Or what's the best way to configure pooling? Is that a good idea in general to use the Tomcat mechanism or should I consider something like DBConnectionBroker? Thanks again Nadia -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 3:15 PM To: Tomcat Users List Subject: RE: connection pooling Howdy, Thanks, but do you know what is abandoned connection? As I understand it, abandoned connection is the one that has not been used in some time but it still could be a live connection. I need to go through all the connections in the pool and check if every connection is a valid, live connection and not whether it has been used recently. Does Tomcat allow me to do that? And how do I retrieve all the used connections to check every one of them? You don't need to do this manually: set a validation query for your pool and DBCP will validate all your connections for you. Tomcat is not a connection pooling product by itself. It simply allows you to use JNDI to configure other connection pooling products, like DBCP or Oracle's connection pooling implementation. Each of those products have their own features and documentation you will need to consult. Yoav Shapira 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: connection pooling
Howdy, Tomcat uses DBCP by default for connection pooling, although you can use other packages as well. DBCP supports evicting idle connections with a configurable timeout on how long the connection must be idle before eviction. DBCP also supports configurable validation queries (checking for stale / bad connections). See DBCP API JavaDocs at http://jakarta.apache.org/commons/dbcp/apidocs/index.html See Tomcat DBCP (and other) connection pool configuration examples at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples -howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations Yoav Shapira Millennium ChemInformatics -Original Message- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 12:39 PM To: [EMAIL PROTECTED] Subject: connection pooling Hi, I'm using Tomcat 4.0.4 and I'm wondering if setting up a connection pooling will give me a capability to set up some time intervals according to which my pool manager will check if connections are active and recycle them if they are not. Does Tomcat have this capability? ( is there something like pool manager that goes aroung checking for connections?) In the Jakarta documentation you can find how to set up and obtain the connection through the new datasource, but there is nothing about how to explicitly use this pool to check for stale connections and such. Plese, let me know where I can find this. Are there some free packages I can download and use? Thank you very much for your help. Nadia - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling
Thanks, but do you know what is abandoned connection? As I understand it, abandoned connection is the one that has not been used in some time but it still could be a live connection. I need to go through all the connections in the pool and check if every connection is a valid, live connection and not whether it has been used recently. Does Tomcat allow me to do that? And how do I retrieve all the used connections to check every one of them? Nadia -Original Message- From: Shapira, Yoav [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 12:44 PM To: Tomcat Users List Subject: RE: connection pooling Howdy, Tomcat uses DBCP by default for connection pooling, although you can use other packages as well. DBCP supports evicting idle connections with a configurable timeout on how long the connection must be idle before eviction. DBCP also supports configurable validation queries (checking for stale / bad connections). See DBCP API JavaDocs at http://jakarta.apache.org/commons/dbcp/apidocs/index.html See Tomcat DBCP (and other) connection pool configuration examples at: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples -howto.html#Database%20Connection%20Pool%20(DBCP)%20Configurations Yoav Shapira Millennium ChemInformatics -Original Message- From: Nadia Kunkov [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 04, 2003 12:39 PM To: [EMAIL PROTECTED] Subject: connection pooling Hi, I'm using Tomcat 4.0.4 and I'm wondering if setting up a connection pooling will give me a capability to set up some time intervals according to which my pool manager will check if connections are active and recycle them if they are not. Does Tomcat have this capability? ( is there something like pool manager that goes aroung checking for connections?) In the Jakarta documentation you can find how to set up and obtain the connection through the new datasource, but there is nothing about how to explicitly use this pool to check for stale connections and such. Plese, let me know where I can find this. Are there some free packages I can download and use? Thank you very much for your help. Nadia - 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: connection pooling
Howdy, Thanks, but do you know what is abandoned connection? As I understand it, abandoned connection is the one that has not been used in some time but it still could be a live connection. I need to go through all the connections in the pool and check if every connection is a valid, live connection and not whether it has been used recently. Does Tomcat allow me to do that? And how do I retrieve all the used connections to check every one of them? You don't need to do this manually: set a validation query for your pool and DBCP will validate all your connections for you. Tomcat is not a connection pooling product by itself. It simply allows you to use JNDI to configure other connection pooling products, like DBCP or Oracle's connection pooling implementation. Each of those products have their own features and documentation you will need to consult. Yoav Shapira This e-mail, including any attachments, is a confidential business communication, and may contain information that is confidential, proprietary and/or privileged. This e-mail is intended only for the individual(s) to whom it is addressed, and may not be saved, copied, printed, disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately delete this e-mail from your computer system and notify the sender. Thank you. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling saga
who needs foreign keys, they only slow your DB down anyway :) DBCP can support any DB, you will need an ODBC bridge for Access, then you just give DBCP the odbc bridge driver info, and it should work Filip -Original Message- From: JS [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 4:06 PM To: [EMAIL PROTECTED] Subject: connection pooling saga Hello. Has anyone ever done connection pooling with MS Access and tomcat 4.1.12? I havent had much luck in trying to find this done anywhere, and much of the advice is to go with mySQL. Though I am reluctant to due to the lack of Foreign Key support in mySQL and the fact that I have done alot with Access. I have read the DBCP tomcat support docs, but this is only geared towards mySQL, does such a thing exist for MS Access? Advance thanks JS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling saga
Uh, you don't want to use the Access with Java, at least not unless you mind rebooting your server on a regular basis. The JDBC-ODBC bridge has a memory leak. And besides I've been hearing that even Microsoft isn't doing anything with Access (using SQL Server run-time instead). Also that it might be going away in one of the next few releases. But if you have to use Access all you should have to do is change the JDBC URL. --mikej -=- mike jackson [EMAIL PROTECTED] -Original Message- From: JS [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 4:06 PM To: [EMAIL PROTECTED] Subject: connection pooling saga Hello. Has anyone ever done connection pooling with MS Access and tomcat 4.1.12? I havent had much luck in trying to find this done anywhere, and much of the advice is to go with mySQL. Though I am reluctant to due to the lack of Foreign Key support in mySQL and the fact that I have done alot with Access. I have read the DBCP tomcat support docs, but this is only geared towards mySQL, does such a thing exist for MS Access? Advance thanks JS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling saga
And who needs views? They only obscure the true source of the data. And who needs sub-queries? You can always re-write your queries. They may not be as intuitive, but hey, it's blindingly fast eh? -Original Message- From: Filip Hanik [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 5:43 PM To: Tomcat Users List; [EMAIL PROTECTED] Subject: RE: connection pooling saga who needs foreign keys, they only slow your DB down anyway :) DBCP can support any DB, you will need an ODBC bridge for Access, then you just give DBCP the odbc bridge driver info, and it should work Filip -Original Message- From: JS [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 4:06 PM To: [EMAIL PROTECTED] Subject: connection pooling saga Hello. Has anyone ever done connection pooling with MS Access and tomcat 4.1.12? I havent had much luck in trying to find this done anywhere, and much of the advice is to go with mySQL. Though I am reluctant to due to the lack of Foreign Key support in mySQL and the fact that I have done alot with Access. I have read the DBCP tomcat support docs, but this is only geared towards mySQL, does such a thing exist for MS Access? Advance thanks JS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: connection pooling saga
Cheers Filip, I didnt realise that DBCP would suppport Access. (1) Doesnt the driver need to be a jar file though?? (2) I thought I needed an actual JDBC driver for MS Access. (3) Does the DBCP support for MS Access Connection Pooling mean that I no longer need my ConnectionPoolServlets to manage the connections. I will read through the HOW-TOs again? Any more advice would be much appreciated JS who needs foreign keys, they only slow your DB down anyway :) DBCP can support any DB, you will need an ODBC bridge for Access, then you just give DBCP the odbc bridge driver info, and it should work Filip -Original Message- From: JS [mailto:[EMAIL PROTECTED] Sent: Monday, March 31, 2003 4:06 PM To: [EMAIL PROTECTED] Subject: connection pooling saga Hello. Has anyone ever done connection pooling with MS Access and tomcat 4.1.12? I havent had much luck in trying to find this done anywhere, and much of the advice is to go with mySQL. Though I am reluctant to due to the lack of Foreign Key support in mySQL and the fact that I have done alot with Access. I have read the DBCP tomcat support docs, but this is only geared towards mySQL, does such a thing exist for MS Access? Advance thanks JS - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Connection pooling (Apache Jakarta-Tomcat)
Take a look under JNDI DataSource and JNDI Resources links on the left hand side of this page: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/index.html Chris Yocum From: Lars Nielsen Lind [EMAIL PROTECTED] Reply-To: Tomcat Users List [EMAIL PROTECTED] To: Tomcat Users List [EMAIL PROTECTED] Subject: Connection pooling (Apache Jakarta-Tomcat) Date: Sat, 15 Mar 2003 09:51:06 +0100 MIME-Version: 1.0 Received: from apache.org ([208.185.179.12]) by mc3-f2.law16.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Sat, 15 Mar 2003 00:51:34 -0800 Received: (qmail 35832 invoked by uid 500); 15 Mar 2003 08:51:19 - Received: (qmail 35819 invoked from network); 15 Mar 2003 08:51:18 - Received: from smtp010.tiscali.dk (212.54.64.103) by daedalus.apache.org with SMTP; 15 Mar 2003 08:51:18 - Received: from notebookxp ([62.79.19.162])by smtp010.tiscali.dk (8.12.5/8.12.5) with SMTP id h2F8pQ52027731for [EMAIL PROTECTED]; Sat, 15 Mar 2003 09:51:28 +0100 (MET) X-Message-Info: JGTYoYF78jEHjJx36Oi8+Q1OJDRSDidP Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm Precedence: bulk List-Unsubscribe: mailto:[EMAIL PROTECTED] List-Subscribe: mailto:[EMAIL PROTECTED] List-Help: mailto:[EMAIL PROTECTED] List-Post: mailto:[EMAIL PROTECTED] List-Id: Tomcat Users List tomcat-user.jakarta.apache.org Delivered-To: mailing list [EMAIL PROTECTED] Message-ID: [EMAIL PROTECTED] X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1106 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N Return-Path: [EMAIL PROTECTED] X-OriginalArrivalTime: 15 Mar 2003 08:51:34.0137 (UTC) FILETIME=[14B61690:01C2EAD0] Hi. I want to use connection pooling with PostgreSQL and JDBC. I have heard of Poolman but the site refers to Apache.org. Where can I find it and is there availbale info on how to use it / implement it? Best regards, Lars Nielsen Lind _ Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling
I have DBCP connection pooling working as follows using Tomcat 4.1.12: Under the Context element for your application (this can either be in the server.xml file or a separate xml file in the webapps dir) I have the following config: Resource name=jdbc/ scope=Shareable type=javax.sql.DataSource/ ResourceParams name=jdbc/ parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valuetheUser/value /parameter parameter namepassword/name valuethePassword/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://hostname:port;databasename=myDB/value /parameter parameter namevalidationQuery/name valueselect getdate()/value /parameter /ResourceParams This is an MS SQL Server config, but to change the db just make sure that the requried JDBC jar file is in the common/lib directory and then change the necessary elements above e.g. driverClassName etc. In my web.xml for my app I have the following: resource-ref res-ref-namejdbc//res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref To use the pool I have the following code in a servlet: (I have left out the try/catch block etc.) Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/); conn = ds.getConnection(); Hope this helps. Malcolm -Original Message- From: Sebastiªo Carlos Santos [mailto:[EMAIL PROTECTED] Sent: 21 February 2003 00:15 To: [EMAIL PROTECTED] Subject: Connection Pooling Somebody has some experience or example in the configuration and use of pool of connections with the commons-dbcp. I am a little lost and I don't know through where to begin. All information will be well arrival. I thank the help in advance __ E-mail Premium BOL Antivírus, anti-spam e até 100 MB de espaço. Assine já! http://email.bol.com.br/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Connection Pooling
This is a Tomcat JNDI implementation. I tried different solutions Tomcat, Oracle connection caching and commons. Among them, Tomcat's is very simple. commons-dbcp + pooling require more coding but have more flexibility of course. Regards, PQ This Guy Thinks He Knows Everything This Guy Thinks He Knows What He Is Doing -Original Message- From: Malcolm Green [mailto:[EMAIL PROTECTED] Sent: February 25, 2003 5:36 AM To: 'Tomcat Users List' Subject: RE: Connection Pooling I have DBCP connection pooling working as follows using Tomcat 4.1.12: Under the Context element for your application (this can either be in the server.xml file or a separate xml file in the webapps dir) I have the following config: Resource name=jdbc/ scope=Shareable type=javax.sql.DataSource/ ResourceParams name=jdbc/ parameter namefactory/name valueorg.apache.commons.dbcp.BasicDataSourceFactory/value /parameter parameter namemaxActive/name value100/value /parameter parameter namemaxIdle/name value3/value /parameter parameter namemaxWait/name value100/value /parameter parameter nameusername/name valuetheUser/value /parameter parameter namepassword/name valuethePassword/value /parameter parameter namedriverClassName/name valuecom.microsoft.jdbc.sqlserver.SQLServerDriver/value /parameter parameter nameurl/name valuejdbc:microsoft:sqlserver://hostname:port;databasename=myDB/value /parameter parameter namevalidationQuery/name valueselect getdate()/value /parameter /ResourceParams This is an MS SQL Server config, but to change the db just make sure that the requried JDBC jar file is in the common/lib directory and then change the necessary elements above e.g. driverClassName etc. In my web.xml for my app I have the following: resource-ref res-ref-namejdbc//res-ref-name res-typejavax.sql.DataSource/res-type res-authContainer/res-auth /resource-ref To use the pool I have the following code in a servlet: (I have left out the try/catch block etc.) Context ctx = new InitialContext(); DataSource ds = (DataSource)ctx.lookup(java:comp/env/jdbc/); conn = ds.getConnection(); Hope this helps. Malcolm -Original Message- From: Sebastiªo Carlos Santos [mailto:[EMAIL PROTECTED] Sent: 21 February 2003 00:15 To: [EMAIL PROTECTED] Subject: Connection Pooling Somebody has some experience or example in the configuration and use of pool of connections with the commons-dbcp. I am a little lost and I don't know through where to begin. All information will be well arrival. I thank the help in advance __ E-mail Premium BOL Antivírus, anti-spam e até 100 MB de espaço. Assine já! http://email.bol.com.br/ - 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]