How can i set JNDI name for Oracle Database

Discussions

EJB programming & troubleshooting: How can i set JNDI name for Oracle Database

  1. Hai friends,
      I used J2SDKEE1.2.1 deployment tool for deploying my entity beans. I didn't find anywhere that how can i set JNDI for Oracle database as persistence storage in my entity bean. I want to know about which type of driver i can used for connect to oracle database.

    I am having j2ee deployment tool at my Windows NT workstation and Oracle database at NT server. Is it necessary oracle8i client software in my workstation for accessing oracle database with my EJB deployer tool. I mean that, can i access database with oracle thin client driver from my work station without installing oracle client software.

    Please help me to post any suggestions you know for using oracle8i databae with J2EE j2sdkee1.2.1 deployment tool

    with Regards,
    Lakshman

  2. OK, U only need to add some info to your Descriptor file

    for example the xml file of J2ee server

          <resource-ref>
    <res-ref-name>jdbc/INSTRUMENTDS</res-ref-name>
    <jndi-name>EcurrencyDS</jndi-name>
    <cmp-resource>True</cmp-resource>
          </resource-ref>
        </session>
      </enterprise-beans>
      <datasource-definitions>
        <datasource>
          <jndi-name>EcurrencyDS</jndi-name>
          <url>jdbc:oracle:thin:@server01:1521:abc</url>
          <username>fastcom</username>
          <password>fastcom</password>
          <driver-class-name>"oracle.jdbc.driver.OracleDriver</driver-class-name>
        </datasource>
      </datasource-definitions>

    and these line in the ejb-jar.xml file

          <resource-ref>
    <res-ref-name>jdbc/INSTRUMENTDS</res-ref-name>
    <res-type>javax.sql.DataSource</res-type>
    <res-auth>Container</res-auth>
          </resource-ref>


    Hope this will help

    Doan