4 Replies Latest reply on Apr 23, 2004 1:12 AM by Jon Barnett

    jdbc not bound

    Richard Grantham Newbie


      I've been hunting around for fixes for the "jdbc not bound" naming exception problem found when trying to create a datasource without any luck. It must be a configuration issue.

      I'm using a PostgreSQL database but cannot connect to it. I just get the "jbdc not bound" error message. My configuration files are below. Can anyone spot the problem.


      <?xml version="1.0" encoding="UTF-8"?>

      <!-- $Id: postgres-ds.xml,v 2003/09/05 16:38:24 patriot1burke Exp $ -->

      <!-- sql to call when connection is created
      <new-connection-sql>some arbitrary sql</new-connection-sql>

      <!-- sql to call on an existing pooled connection when it is obtained from pool
      <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>


      <resource-ref >
      (this is at the start of the file. Should it be at the end?)

      <resource-manager res-class="org.jboss.ejb.deployment.JDBCResource">

        • 1. Re: jdbc not bound
          sesques Novice

          Why don't you try the simplest way:

          1) Copy the file postgres-ds.xml that you can find in docs/examples.jca into the deploy directory (and set the values according to your database).
          2) Configure your beans with the tag in jbosscmp-jdbc.xml
          3) reference the datasource with "java:/FooDS"

          • 2. Re: jdbc not bound
            Richard Grantham Newbie

            Ummm... if you have a look you'd notice that the postgres-service.xml I posted IS the example postgres-ds.xml with the relevant bits changed and some comments removed for brevity.

            Also, I should point out that I am avoiding entity beans in favour of DAOs and such don't have a jbosscmp-jdbc.xml file to use.

            In fact, I am using XDoclet to do the EJB and XML generation. There is a configuration option you can use to specify datasources but it doesn't appear to be working. I shall direct the question at the XDoclet mailing list.

            • 3. Re: jdbc not bound
              Raja Master

              Try something like this in ur ejb-jar.xml
              and in jboss.xml
              <jndi-name>Actual JNDI Name</jndi-name>

              • 4. Re: jdbc not bound
                Jon Barnett Master

                Try the following XDoclet snippet:

                * @ejb.resource-ref res-auth="Application"
                * res-name="jdbc/FooDS"
                * res-type="javax.sql.DataSource"
                * @jboss.resource-ref res-ref-name="jdbc/FooDS"
                * jndi-name="java:/FooDS"

                The JNDI binding for your datasource is "java:/FooDS" as given by the JNDI-name, "FooDS" in the datasource definition (*-ds.xml). The res-ref-name, "jdbc/FooDS" expands to the full reference "java:com/env/jdbc/FooDS".

                Hope that helps.