• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Tim Cooke
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Mikalai Zaikin
  • Carey Brown
  • Piet Souris
Bartenders:
  • Stephan van Hulst

How to access DataSource in Java Files

 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I want to know when we configure a datasource in websphere. How do we actually access this datasource in our java code. Please Help....

 
author & internet detective
Posts: 41992
911
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By looking it up from the JNDI if your code is called by a servlet/ejb. If not, you would have to use an application client.
 
Gaurav Kshatriya
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jeanne

Thank you for the help. Actually i am working on a servlet based application. Its a huge application so there are a lot of files. I have tried a lot but i was not able to get from where it looks up the for the datasource configured in Websphere. I will try to debug according to your advice. Any more pointers will be helpful.
 
Ranch Hand
Posts: 446
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can look in web.xml file for any JDBC resource references. Then use a text editor like Notepad++ to findout usage of resource reference in your Java files.
 
Gaurav Kshatriya
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Deepak Pant wrote:You can look in web.xml file for any JDBC resource references. Then use a text editor like Notepad++ to findout usage of resource reference in your Java files.



Hi Deepak

Thanks for the information. I tried diggin in web.xml. What i understood is like, i found out a servlet in web.xml. In that servlet JNDI lookup is performed. Is this rite ??

 
Life just hasn't been the same since the volcano erupted and now the air is full of tiny ads.
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic