File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB and other Java EE Technologies and the fly likes JNDI mapping in Weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "JNDI mapping in Weblogic" Watch "JNDI mapping in Weblogic" New topic

JNDI mapping in Weblogic

Tony Narvarte

Joined: Aug 12, 2002
Posts: 5
I have a datasource with the JNDI name of DS. In my code I use "java:comp/env/jdbc/DS" as the lookup string. I get an error stating that comp/env/jdbc was found but not DS.
I have also tried prepending the JNDI name with com/env/jdbc/. It then shows up in the JNDI tree under those directories but when I run the web app I get the same error above indicating that the com/env/jdbc directory I have created is not the real one.
Any ideas?
Milind V. Kulkarni

Joined: Apr 12, 2002
Posts: 17
You can use the following code to solve your problem:
public static DataSource objDataSource= ctx = new InitialContext();
DataSource objDataSource = (DataSource) ctx.lookup ("DataSourceName");
Dave Landers
Ranch Hand

Joined: Jul 24, 2002
Posts: 401
When you set up the connection pool and data source, did you Target it to the server? Check the Targets tab in the console for these things to make sure.
If its not "targeted", then it is just configured but not actually running anywhere.
Riaz Mohamed

Joined: May 31, 2002
Posts: 23
try this on your config file
<JDBCDataSource JNDIName="myDataSource" Name="myDataSource"
PoolName="myDataSource" Targets="myserver"/>
This is for the pool cos the datasource would refer to a jdbc connectoin pool
<JDBCConnectionPool CapacityIncrement="2"
DriverName="weblogic.jdbc.informix4.Driver" InitialCapacity="5"
MaxCapacity="25" Name="myDataSource"
Targets="myserver" URL="jdbc:weblogic:informix4 ool@server ort"/>
I agree. Here's the link:
subject: JNDI mapping in Weblogic
It's not a secret anymore!