1 Reply Latest reply on Jun 5, 2003 9:44 AM by jonlee

    problem in connection pooling [JNDI name not bound]

    suncy

      I'm using jboss 3.0 and postgresql 7.x. I tried 2 implement connection pooling . My JNDI name is postgreDS. I am getting the following error

      org.apache.jasper.JasperException: PostgresDS not bound
      I tried to establish connection using the following code
      in my JSP file

      Connection conn= null;
      InitialContext ctx = new InitialContext();
      javax.sql.DataSource ref1 (javax.sql.DataSource) ctx.lookup("java:comp/env/PostgresDS");
      conn = ref1.getConnection();
      Statement stmt =conn.createStatement();
      ResultSet rset=stmt.executeQuery(sql);

      I have taken the configuration file for postgresql from the following path : jboss/docs/examples/jca and
      deployed in default directory.

      I configured the postgres-ds.xml file as below


      <local-tx-datasource>
      <jndi-name>PostgresDS</jndi-name>
      <connection-url>jdbc:postgresql://localhost/Mail</connection-url>
      <driver-class>org.postgresql.Driver</driver-class>
      <user-name>Administrator</user-name>
      sam

      <min-pool-size>5</min-pool-size>
      <max-pool-size>100</max-pool-size>
      <blocking-timeout-millis>5000</blocking-timeout-millis>
      <idle-timeout-minutes>15</idle-timeout-minutes>

      </local-tx-datasource>




      I am looking forward for suggestions.


        • 1. Re: problem in connection pooling [JNDI name not bound]
          jonlee

          I assume you are actually using JBoss 3.2.x as you have shown content for a *-ds.xml rather than a *-service.xml of JBoss 3.0.x.

          Assuming this, if you use the jmx-console web application that is included in the default instance (http://localhost:8080/jmx-console), you can browse and find the JNDI binding for your data source.

          You will find, that the JNDI binding, based on your example, is java:/PostgresDS.

          So your lookup should be "java:/PostgresDS".

          Hope that helps.