1 Reply Latest reply on Aug 31, 2005 6:48 AM by Jamie Cash

    JNDI Datasource points to MySQL database

    Mohamed Fathy Newbie

      Hi all,

      I am new to JBoss. I want to create new JNDI DataSource called: "java:/Timesheet" to point to a mysql databsase.
      How could I do that ?

      I was lost in the Documentation and need someones help.

      yours,
      Mohamed Fathy Abd El Aziz

        • 1. Re: JNDI Datasource points to MySQL database
          Jamie Cash Newbie

          Create a file called timesheet-ds.xml in your deploy directory with the following contents (changing server, username , password and testsqlsettings where relivent).

          <datasources>
           <local-tx-datasource>
           <jndi-name>Timesheet</jndi-name>
           <connection-url>jdbc:mysql://server:3306/jbossdb</connection-url>
           <driver-class>com.mysql.jdbc.Driver</driver-class>
           <user-name>username</user-name>
           <password>password</password>
           <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
           <!-- sql to call when connection is created
           <new-connection-sql>testsql</new-connection-sql>
           -->
           <!-- sql to call on an existing pooled connection when it is obtained from pool
           <check-valid-connection-sql>testsql</check-valid-connection-sql>
           -->
          
           <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional) -->
           <metadata>
           <type-mapping>mySQL</type-mapping>
           </metadata>
           </local-tx-datasource>
          </datasources>