1 Reply Latest reply on Jun 19, 2003 9:03 AM by Jon Barnett

    jndi datasource not found?

    maomao1234 Newbie

      i am use jboss-3.0_tomcat-4.1 . after deployed, running, system post error :
      jndi datasource not found?
      code below:
      //ctx is initContext object.
      Datasource ds = (DataSource)ctx.lookup("java:comp/jdbc/DataSource");
      how to write "java:comp/jdbc/DataSource" ???
      i am using Sybase 11.5 Database and using jconnect5.5 .
      please help me ,and glad to any hint . thanks

        • 1. Re: jndi datasource not found?
          Jon Barnett Master

          OK. Assume you have a datasource, sybase-ds.xml defined in the server/default/deploy directory of JBoss.
          <?xml version="1.0" encoding="UTF-8"?>

          <!-- ===================================================================== -->
          <!-- -->
          <!-- JBoss Server Configuration -->
          <!-- -->
          <!-- New ConnectionManager setup for Sybase ASE/ASA jConnect driver -->
          <!-- Thanks to Marc Zampetti <zampetti@aol.net> -->
          <!-- This is a minimal example. See the generic example for other stuff -->
          <!-- ===================================================================== -->

          <!-- $Id: sybase-ds.xml,v 1.1 2002/07/31 21:58:44 d_jencks Exp $ -->



          <local-tx-datasource>
          <jndi-name>jdbc/SybaseDB</jndi-name>
          <!-- Sybase jConnect URL for the database.
          NOTE: The hostname and port are made up values. The optional
          database name is provided, as well as some additinal Driver
          parameters.
          -->
          <connection-url>jdbc:sybase:Tds:host.at.some.domain:5000/db_name?JCONNECT_VERSION=6</connection-url>
          <driver-class>com.sybase.jdbc2.jdbc.SybDataSource</driver-class>
          <user-name>x</user-name>
          y
          </local-tx-datasource>



          The datasource connection is:
          Datasource ds = (DataSource)ctx.lookup("java:/jdbc/SybaseDB");

          You can also see your JNDI bindings in the JBoss jmx-console webapp, from the jndi-view link.