cancel
Showing results for 
Search instead for 
Did you mean: 

HOW TO CREATE CONNECTION POOL

Former Member
0 Kudos

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

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

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

Vlado
Advisor
Advisor
0 Kudos

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

Vlado
Advisor
Advisor
0 Kudos

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

Former Member
0 Kudos

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>

Vlado
Advisor
Advisor
0 Kudos

Well, the <resource-ref> in the web-j2ee-engine.xml is useless since it does not contain any additional information. You can remove it. If the problem still exists, please provide the whole stack trace of the NamingException.

-Vladimir