1 Reply Latest reply on Nov 8, 2004 11:55 AM by a d

    Accessing Datasource error

    a d Newbie


      I have got some problem in trying to access my mySQL DB from my ear.
      I use Jboss4.0 with MySQL and I have got the following error in Jboss console:

      14:40:05,625 INFO [STDOUT] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.NameNotFoundException: jdbc_AdminDB not bound]
      14:40:05,625 INFO [STDOUT] at org.jnp.interfaces.NamingContext.resolveLink(NamingContext.java:971)
      14:40:05,625 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:614)
      14:40:05,625 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:643)
      14:40:05,625 INFO [STDOUT] at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:508)
      14:40:05,625 INFO [STDOUT] at javax.naming.InitialContext.lookup(InitialContext.java:347)
      14:40:05,625 INFO [STDOUT] at com.iratensolutions.applications.ejb.admin.tools.AdminTools.getConnection(AdminTools.java:36)

      But when I look in the begining of the Jboss console I can see that jdbc_AdminDB is known :

      14:39:23,406 INFO [WrapperDataSourceService] Bound connection factory for resource adapter for ConnectionManager 'jboss.jca:name=jdbc_AdminDB,service=DataSourceBinding to JNDI name 'java:jdbc_AdminDB'

      Here is a part of my jboss.xml File:

      Here is the way I call my DB from my code

       static public Connection getConnection(InitialContext jndiContext) {
       Connection connection = null;
       try {
       DataSource ds = (DataSource) jndiContext.lookup("java:comp/env/jdbc/AdminDB");
       connection = ds.getConnection();
       } catch (NamingException ne) {
       } catch (SQLException sqle) {
       String message = "Error when connecting to the Administration database. Maybe you don't have access rights.";
       AdminAgentLogger.logException(message, sqle);
       return connection;

      And finally my Admin-ds.xml file
      <?xml version="1.0" encoding="UTF-8"?>
      <!-- $Id: mysql-ds.xml,v 1.2 2003/12/12 19:22:31 starksm Exp $ -->
      <!-- Datasource config for MySQL using 3.0.9 available from:

      Where am I doing wrong ? I think its a problem of configuration
      please help
      Thanks in advance