5 Replies Latest reply on Apr 3, 2007 6:23 AM by vikas nahar

    error while connecting to oracle db

    vikas nahar Newbie

      this is my portal-oracle-ds.xml file


      <local-tx-datasource>
      <jndi-name>DatabaseConnection</jndi-name>
      <connection-url>jdbc:oracle:thin:@localhost:1521:orcl</connection-url>
      <driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
      <user-name>scott</user-name>
      tiger
      <min-pool-size>1</min-pool-size>
      <max-pool-size>10</max-pool-size>
      </local-tx-datasource>



      i have stored this file in deploy directory

      following is the java file which tries to acces the db

      public class HelloVikas extends GenericPortlet
      {

      protected void doView(RenderRequest rRequest, RenderResponse rResponse)
      throws IOException, PortletException
      {
      rResponse.setContentType("text/html");
      PrintWriter out = rResponse.getWriter();
      out.write("hello mr vikas nahar");
      out.close();
      try
      {
      System.out.println("connecting to database");
      Context ctx = new InitialContext();
      DataSource ds = (DataSource)ctx.lookup("DatabaseConnection");
      System.out.println("connected to.....................................");

      }
      catch (Exception e)
      {
      System.out.println(e);
      }
      }
      };


      and i get the following error:
      javax.naming.NameNotFoundException: DatabaseConnection not bound