• Post Reply Bookmark Topic Watch Topic
  • New Topic

Multiple Datasource declaration in tomcat context.xml

Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear All,

I need to have multiple connection pools in my application. As I am using Tomcat 8.x , I have decided to use the tomcat container for managing my data sources.
For this I made multiple entries in context.xml for Resource tag

And for getting connection I look up the context and all DataSources present in the context.
I save all datasources in a Map<String,DataSource> and able to create connection with each datasource.

I am confused that if I call close on the retrieved connection , Will it be returned to the pool from which it was fetched ? Or It will be lost?
What will happen to such Connection object?

Please guide me.

Thanks in advance.

Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!