This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Connection pooling

 
Cristian Popovici
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good day people,

I have one question:
How can I define a database connection pooling with Tomcat that can be used by multiple applications?

Have a great day,
Cris.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
 
Maurizio Nagni
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you can use either the admin console or edit by hand the server.xml file and add something like into the <GlobalNamingResources> tag




now, from your application(s) you can call the connection using a code like



obviously if you do not use Mysql you need to change the driver and the url format.
 
Cristian Popovici
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible if is defined in the GlobalNamingResources ?

Thanks for the help.
Cris.
 
Cristian Popovici
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much for your help!

Cheers.
 
Cristian Popovici
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get this error:

Name jdbc is not bound in this Context

Any idea why?
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Looks like the datasource is bound to jdbc/passport. So try using:

 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!