• No replies
1215 Posts

Pinned topic Datasource JNDI-Name

‏2006-08-03T15:04:40Z |

I'm using WebSphere Application Server 6.0 and RAD.
I want to make a Database connection to Oracle 9i.

So I tried:
public DBAccess(PrintWriter out) throws NamingException{
Hashtable env = new Hashtable();
InitialContext ctx = new InitialContext(env);
DataSource ds = (DataSource) ctx.lookup("java:comp/env/myDatasource");

public void openConnection()
but got the following error:
A in the context "java:" found reference object named "comp/env/myDatasource" was sent to the JNDI Naming Manager gesendet. Following exception was logged. The reference data follows:
Classname of Reference-Factory:
Positions-URLs der Referenz-Factory-Klasse: <null>
Reference Class Name: java.lang.Object
Type: ResRefJndiLookupInfo
Content: ResRefJndiLookupInfo: Look up Name="myDatasource";JndiLookupInfo: jndiName="MYDB"; providerURL=""; initialContextFactory=""

I also made an entry in the reference tab of Web-Deployment-Descriptor:

<resource-ref id="ResourceRef_1154610114018">

The database is called MYDB. I think the problem is that I don't know how the JNDI-name of the database is. How do I have to set the JNDI-Name of the database?

Hope, someone can help me.
Thank you in advance!