Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Manage DataSource via Spring issue  RSS feed

 
Benson Fung
Ranch Hand
Posts: 220
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Misra
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!