Mark: I came across the same problem, of sort. If you are using connection pooling, you cannot change the user and database you are connected to at run time.
This just defeats the purpose of database connection pooling. You want to setup a predifined number of open connections to your database that your application will utilize. So, when Tomcat starts up, your database connections are already established and opened, hence you cannot specify a new user or database to connect to. If you are needing to specify the above mentioned items, then I would suggest database connection pooling is not for you. Hope this helps, Ej "Mark Lenz" <[EMAIL PROTECTED]> on 10/18/2002 12:46:23 PM Please respond to "Tomcat Users List" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> cc: Subject: Re: Tomcat Connection Pooling When I try that, I get a java.lang.UnsupportedOperationException at org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:125) at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:329) ... It's thrown during the getConnection(username, password) function. I tried including the username and password parameters in the server.xml file without a value like this: <parameter> <name>username</name> <value></value> </parameter> And also completely excluding the username and password parameters. Mark Lenz (920) 832-3523 [EMAIL PROTECTED] Leo Przybylski <[EMAIL PROTECTED]> To: Tomcat Users List <[EMAIL PROTECTED]> cc: 10/17/2002 05:31 PM Subject: Re: Tomcat Please respond to "Tomcat Connection Pooling Users List" If you are using multiple databases, I believe you have to set up multiple "Resources" (one for each database). However, you do not have to specify a username/password. When you retrieve your DataSource from the "java:comp/env" namespace, you can use getConnection( username, password). If you don't use multiple users for the database, then this may seem impractical. You do need a different "Resource" definition for each database though. -Leo http://www.foopan.ath.cx On Thu, 2002-10-17 at 14:19, Mark Lenz wrote: > I'm trying to set up DB Connection Pooling with Tomcat 4.1.12 and MySQL > 4.0.4. Looking at the sample xml configs I noticed that you have to > specify the database, username and password. Is there a way that I can > change the username and database from within my JSP's? Or do I just have > to create different DB contexts in the server.xml file for each database I > want to use and which user I want to connect with? > > Mark Lenz > (920) 832-3523 > [EMAIL PROTECTED] > > The information contained in this electronic mail message is confidential information and intended only for the use of the individual or entity named above, and may be privileged. If the reader of this messages is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, please contact the sender immediately, delete this material from your computer and destroy all related paper media. Please note that the documents transmitted are not intended to be binding until a hard copy has been manually signed by all parties. > Thank you. -- To unsubscribe, e-mail: < mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: < mailto:tomcat-user-help@;jakarta.apache.org> The information contained in this electronic mail message is confidential information and intended only for the use of the individual or entity named above, and may be privileged. If the reader of this messages is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, please contact the sender immediately, delete this material from your computer and destroy all related paper media. Please note that the documents transmitted are not intended to be binding until a hard copy has been manually signed by all parties. Thank you. -- To unsubscribe, e-mail: < mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: < mailto:tomcat-user-help@;jakarta.apache.org> ********************************************************************************** Confidentiality Notice: This email message, including any attachments, contains or may contain confidential information intended only for the addressee. If you are not an intended recipient of this message, be advised that any reading, dissemination, forwarding, printing, copying or other use of this message or its attachments is strictly prohibited. If you have received this message in error, please notify the sender immediately by reply message and delete this email message and any attachments from your system. ********************************************************************************** -- To unsubscribe, e-mail: <mailto:tomcat-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:tomcat-user-help@;jakarta.apache.org>