| 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
internet detective
Marshal
Joined: May 26, 2003
Posts: 26193
|
|
|
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: 443
|
|
|
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 ??
|
 |
 |
|
|
subject: How to access DataSource in Java Files
|
|
|