• 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
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

JNDI Resource Bindings

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using WSAD 5.1.0 to develop my appln. When i tried to explore the JNDI through the servlet which connects to a DB2 database and displays records from a table, I'm getting the expected result. But in the server's console window, I am seeing the following error message:

"Resource reference jdbc/Db2TDataSource could not be located, so default values of the following are used: [Resource-ref settings]
Resource reference jdbc/sbtdatasource could not be located, so default values of the
following are used: [Resource-ref settings]

res-auth: 1 (APPLICATION)
res-isolation-level: 0 (TRANSACTION_NONE)
res-sharing-scope: true (SHAREABLE)
res-resolution-control: 999 (undefined),"

In my web.xml file, I have given a reference name to the JNDI name 'jdbc/DB2TDataSource' and I'm using the reference name in the Initial context lookup. The code snippet goes like this.

InitialContext ctx = null;
ctx = new InitialContext();
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/DB2TDataSource");

I had read in the earlier postings that I need to use a Resource reference value in the Initial Context lookup for this error to stop. But I still get the above error in my console window.

Need help in this regard.

Regards,
Ananth
 
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I've defined a datasource, giving a jndi binding of 'jdbc/ds1'.

This is the name I use when attempting to connect to the datasource


In your case try altering the following line from

to


Good luck.
 
Ranch Hand
Posts: 106
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Usage of JNDI names is deprecated in Webshpere. You have to use reference bindings.
Define the resource references to the Database JNDI in web/ejb deployment descriptors, and use context.lookup("java:comp/env/<YOUR REF JNDI>").

This will suppress the warning (its not an error) in the console
 
Popeye has his spinach. I have this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic