2 Replies Latest reply on Apr 7, 2006 5:08 PM by Frank Langelage

    javax.naming.NameNotFoundException: OracleDS not bound

    Srivathsa Newbie

      Hi,

      I have configured the Oracle-ds.xml as follows:

      <datasources>
       <local-tx-datasource>
       <jndi-name>OracleDS</jndi-name>
       <connection-url>jdbc:oracle:thin:@192.168.150.122:1521:dna</connection-url>
       <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
       <user-name>admin</user-name>
       <password>admin</password>
       <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter</exception-sorter-class-name>
      
       <metadata>
       <type-mapping>Oracle11g</type-mapping>
       </metadata>
       </local-tx-datasource>
      
      </datasources>
      


      I am using my JSP to connect to the Database:
      <%
      String sql = "select * from product";
      try{
      
      Properties env = new Properties();
      
      env.setProperty(Context.INITIAL_CONTEXT_FACTORY,
       "org.jnp.interfaces.NamingContextFactory");
      env.setProperty(Context.PROVIDER_URL,
       "jnp://localhost:1099");
      env.setProperty(Context.URL_PKG_PREFIXES,
       "org.jboss.naming:org.jnp.interfaces");
      
      InitialContext iniCtx = new InitialContext(env);
      
      Object ref = iniCtx.lookup("OracleDS");
      //I tried using java:OracleDS and java:/OracleDS
      
      
      Connection conn = (Connection) ref;
      
      Statement stmt = conn.createStatement();
      
      ResultSet res = stmt.executeQuery(sql);
      }catch(Exception e){
       out.println("In exception blocl.....");
       out.println("The exc is :"+e);
      }
      %>
      </body>
      </html>
      


      Can anybody please suggest me the solution.

      Thanks in Advance.

      Thanks
      SriVathsa