0 Replies Latest reply on Jun 14, 2007 4:27 PM by Roohbir Singh

    accessing a database in jboss

    Roohbir Singh Newbie


      I have a small application where I access a database using ejb with jsp/servlets. The application is working ok but I have a question about the mysql-ds.xml file and ejb-jar.xml file.

      I have pasted the 2 files below. The thing is at the moment I have specified the name of the database in mysql-ds.xml. I would like to state this name in the ejb-jar.xml file so that I do not have to change the name of the database everytime I have to access one.

      Shall be thankful if somebody could advise me.



      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

      Customer Info Stateless Session Bean Application
      <display-name>Customer Info Stateless Session Bean</display-name>

      This is a reference to a JDBC database.



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

      <!-- $Id: mysql-ds.xml 41016 2006-02-07 14:23:00Z acoliver $ -->
      <!-- Datasource config for MySQL using 3.0.9 available from:


      <!-- should only be used on drivers after 3.22.1 with "ping" support
      <!-- 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 - MySQLValidConnectionChecker is preferred for newer drivers
      <check-valid-connection-sql>some arbitrary sql</check-valid-connection-sql>

      <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->