This week's book giveaway is in the General Computing forum.
We're giving away four copies of Arduino in Action and have Martin Evans, Joshua Noble, and Jordan Hochenbaum on-line!
See this thread for details.
The moose likes JDBC and the fly likes Getting Datasource from Context Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "Getting Datasource from Context" Watch "Getting Datasource from Context" New topic
Author

Getting Datasource from Context

Jeff Ma
Greenhorn

Joined: Feb 14, 2006
Posts: 6
Getting Datasource from Context.
DataSource pool = (DataSource) env.lookup("jdbc/oracle-8i-athletes");

a) Place this code in init() of every servlet.
b) Place this code in a servlet that can be called along with application starting, then save the pool into application scope.
which solution is better?
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Getting Datasource from Context
 
Similar Threads
Have Been Struggling for More Than a Week. Tomcat Connection Pool Configuration Prob
Difference between getting Connection directly from the pool or from a DataSource
Reading data from multiple tables. Any better way than this?
database connection in init() of servlet
Closing The connection (Database)