wood burning stoves*
The moose likes Other Application Frameworks and the fly likes Manage DataSource via Spring issue Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Manage DataSource via Spring issue" Watch "Manage DataSource via Spring issue" New topic
Author

Manage DataSource via Spring issue

Benson Fung
Ranch Hand

Joined: Apr 10, 2003
Posts: 207
Hi all,

I have setup a jdbc datasource in tomcat's context.xml, e.g. the jndi is jdbc/postgres. How can I retrieve the Connection object from this datasource via Spring configuration file? Please help give me example.


Thanks
Benson
Anadi Misra
Ranch Hand

Joined: Jun 03, 2008
Posts: 69
Hi,

If you are using spring 2.5.X add the following to your application context xml



for apring 2.0.X the way is



Anadi Mishra.
Anadi Misra
Ranch Hand

Joined: Jun 03, 2008
Posts: 69
Forgot to add this earlier

The better way to add the context is to put a xml file with your webapps name under conf/Catalina/localhost directory

See this

Tomcat Config Context
 
 
subject: Manage DataSource via Spring issue
 
Similar Threads
about jdbc provider
StoredProcedure on a DBLink.
spring
How to Refer Tomcat datasource via JNDI in Spring configuration???
DataSource in Spring wiht Hibernate