aspose file tools*
The moose likes Websphere and the fly likes How to access DataSource in Java Files Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "How to access DataSource in Java Files" Watch "How to access DataSource in Java Files" New topic
Author

How to access DataSource in Java Files

Gaurav Kshatriya
Ranch Hand

Joined: Mar 07, 2010
Posts: 33
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....


Thanks
Gaurav.... Cheers....
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31062
    
232

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Gaurav Kshatriya
Ranch Hand

Joined: Mar 07, 2010
Posts: 33
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.
Deepak Pant
Ranch Hand

Joined: Feb 13, 2004
Posts: 445
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

Joined: Mar 07, 2010
Posts: 33
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 ??

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to access DataSource in Java Files