Skip to Content
Former Member
Nov 23, 2005 at 10:05 AM

Datasource Lookup from Server component



I know the issue has been risen a couple of times here, but I was not able to find the solution for me. I cannot retrieve my datasource for my server component. I am a not to sure about some configuration details:

<b>1. Visual Admistrator - JDBC Connector configuration</b>

How does the application name affect the lookup operation of the DS in JNDI. Or is it simply a name to group datasources?

<b>2. Configuration of the DataSource</b>

I have a DS with the name direct_jdbc and an alias myApp/jdbc/datasources/direct_jdbc. I can see the datasource in the JNDI Registry at multiply nodes.

+ root/jdbc/direct_jdbc

+ root/jdbc/myApp/jdbc/datasources/direct_jdbc

+ root/jdbc/notx/direct_jdbc

+ root/jdbc/notx/myApp/jdbc/datasources/direct_jdbc

+ root/jdbc/client/jdbc/direct_jdbc

+ root/jdbc/client/jdbc/myApp/jdbc/datasources/direct_jdbc

Why are the "notx" and "client" nodes containing DS references? Which one do I need to lookup?

I have defined the following <db-properties> in my persistent.xml files:


My client lookup is as follows:

InitialContext ctx = new InitialContext();
DataSource ds = (DataSource) ctx.lookup("jdbc/myApp/jdbc/datasources/direct_jdbc");
Connection con = ds.getConnection();

The lookup results in the following Exception
Object not found in lookup of myApp/jdbc/datasources/direct_jdbc.

I really don't see why this is not working. The datasource is defined and the JNDI-path looks ok to me. Why does the lookup fail?

Any answers are highly appreciated.

best regards