Hi I don't use Tomcat personally, but in almost all of the appservers out of there you find an implementation of javax.sql.DataSource. What you do usually is to configure your pools in the appserver's configuration file, where you put all of the coordinates, then you access them thru JNDI e.g. DataSource myDataSource = new InitialContext().lookup(myDataSourceJndiName)
With Struts I made a simple plugIn that does the necessary JNDI lookup at startup, and then puts the references to the datasources in servletContext. I believe Tomcat 4x+ has a JNDI provider too. -----Messaggio originale----- Da: Geeta Ramani [mailto:[EMAIL PROTECTED] Inviato: giovedì 20 maggio 2004 14.52 A: Struts Users Mailing List Oggetto: RE: Multiple Databases. Vishal: If you are using tomcat, then I believe you can use dbcp. (I think that's what Riyad Kalla was talking about too..) We use dbcp but only for connecting to one pool (and this turned out to be quite simple: just configure the server.xml), but I think I read that you can create multiple pools, which seems to be what you need. (My guess is you add more <Resource elements in your particular context in the server.xml and give all the db info in the corresponding ResourceParams.. Like I said, i haven't doene this with multiple databases, but seems like the machinery is there.. This article contains a link with an example and a "How to tell tomcat to use dbcp" piece: http://www.midrangeserver.com/mpo/mpo081502-story04.html And here's a detailed how-to: http://jakarta.apache.org/tomcat/tomcat-4.1-doc/jndi-datasource-examples-how to.html Regards, Geeta > -----Original Message----- > From: Vishal Arora [mailto:[EMAIL PROTECTED] > Sent: Thursday, May 20, 2004 1:22 AM > To: Struts Users Mailing List > Subject: Re: Multiple Databases. > > > well that not the problem but my problem is that i want to > connect to > different databases in my application and i m using > datasource object and > in my xml file i have given the details of my database > url,username,password etc etc. but now i want to connect to another > database and if in struts-config.xml i give information abt > other database > .but when in my controller when i will give call to my > datasource object to > which database the connection will be made and how can i handle > it..like if i want to make connection to Database A and after > sometime in > the same file if i want to make connection to DatabaseB how > will it work and > what all changes i will have to make.and where. Pleaseif > anybody can provide > an example it will be very helpfull. > > Thanks.> --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]