Help coderanch get a
new server
by contributing to the fundraiser
  • 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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: 41945
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 ??

 
A berm makes a great wind break. And we all like to break wind once in a while. Like this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/t/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic