on 02-01-2007 4:38 AM
Hi everyone,
Our application connects to Oracle database and we installed the Drivers and created DataSourceName successfully.
When we are trying to lookup its throwing exception, below are the details.
CODE:
InitialContext ic = new InitialContext();
out.println("Initial Context="+ic);
DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/DB");
DATASOURCE.XML
<data-source>
<data-source-name>jdbc/DB</data-source-name>
<driver-name>oracle.jdbc.driver.OracleDriver</driver-name>
<sql-engine>native_sql</sql-engine>
<jdbc-1.x>
<driver-class-name>oracle.jdbc.driver.OracleDriver</driver-class-name>
<url>jdbc:oracle:thin:@192.168.68.15:1521:ORCL</url>
<user-name>etrans22dev</user-name>
<password>etrans</password>
</jdbc-1.x>
</data-source>
EXCEPTION :
"Exception during lookup operation of object with name webContainer/applications/sap.com/SAP eTrans689/eTrans689/java:comp/env/jdbc/DB, cannot resolve object reference '
HOW TO CREATE A CONNECTION POOL WITH JNDI NAME "ORACLE POOL" FOR DATASOURCE "jdbc/DB"
Regards
Muthu
Hi
Here is the actual content of web-j2ee-engine.xml.
<resource-ref>
<res-ref-name>jdbc/DB</res-ref-name>
<res-link>oraclePool</res-link>
</resource-ref>
Regards
muthu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
OK, read the document linked above, this time more carefully
It says that the value of the JNDI Name field (i.e. <res-link>) "must be the same as the value of the <data-source-name> tag you specified in the data-sources.xml descriptor".
And you can also just remove the whole <resource-ref> declaration from the web-j2ee-engine.xml since the <res-ref-name> in web.xml is already equal to your <data-source-name>.
-Vladimir
Hi,
Have you configured correctly the <resource-ref> for the DataSource in your web.xml (or with the @Resource annotation?) For more information --> <a href="http://help.sap.com/saphelp_nw04/helpdata/en/15/6d56f65fb59e4db97253c89c5cfefd/frameset.htm">Configuring Resource References</a> (the screens are different but the XML elements are still the same).
HTH!
-Vladimir
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Below is the code what i have and " jdbc/DB " is the datasource i created thru command promt in Telnet admin.My error says."<b>Got an exception! Exception during lookup operation' </b>
<b>web.xml</b>
<resource-ref>
<description>No Description</description>
<res-ref-name>jdbc/DB</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<b>web-j2ee-engine.xml</b>
<resource-ref>
<res-ref-name>jdbc/DB</res-ref-name>
</resource-ref>
<b>data-source.xml</b>
<data-source>
<data-source-name>jdbc/DB</data-source-name>
<driver-name>oracle.jdbc.driver.OracleDriver</driver-name>
<sql-engine>native_sql</sql-engine>
<jdbc-1.x>
<driver-class-name>oracle.jdbc.driver.OracleDriver</driver-class-name>
<url>jdbc:oracle:thin:@192.168.68.15:1521:ORCL</url>
<user-name>etrans22dev</user-name>
<password>etrans</password>
</jdbc-1.x>
</data-source>
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.