2 Replies Latest reply on May 17, 2006 1:27 PM by Feris Thia

    About DataSource JNDI

    Feris Thia Newbie

      Hi All,

      I set up mysql data source (msql-ds.xml) like below

      <?xml version="1.0" encoding="UTF-8"?>
      <!-- $Id: mysql-ds.xml,v 2004/12/01 11:46:00 schrouf Exp $ -->
      <!-- Datasource config for MySQL using 3.0.9 available from:
       <!-- 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>
       <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->

      and succeed access it within the same computer with the following code snippets

       Properties props = new Properties();
       InitialContext jndiContext = new InitialContext(props);
       DataSource ds = (DataSource) jndiContext.lookup("java:MySqlDS");

      It's working fine.... but when I move my code to another computer and change the java.naming.provider.url to my computer ip address ( as shown below


      It gets error something about "not bound... " I forget the error details, cause now I'm using my notebook and have no other computer to connect with. But I experienced this at the office.

      What I'm asking is, am I writing a right code ? Is that possible to access data source JNDI resources through network ? Because I don't have any problem when using EJB with JNDI.