[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: JBOSS 4.2.0 & MySQL

andydale do-not-reply at jboss.com
Tue Jun 5 04:38:24 EDT 2007


Hi,

I would create a mysql-ds.xml file in /deploy.  I have copied the standard example one that comes with JBoss 4.0.4/5 (it should hopefully just work with 4.2.0GA as well):

<?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:
http://www.mysql.com/downloads/api-jdbc-stable.html
-->

  | <datasources>
  |   <local-tx-datasource>
  |     <jndi-name>MySqlDS</jndi-name>
  |     <connection-url>jdbc:mysql://mysql-hostname:3306/jbossdb</connection-url>
  |     <driver-class>com.mysql.jdbc.Driver</driver-class>
  |     <user-name>x</user-name>
  |     <password>y</password>
  |     <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
  |     <!-- should only be used on drivers after 3.22.1 with "ping" support
  |     <valid-connection-checker-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker</valid-connection-checker-class-name>
  |     -->
  |     <!-- 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) -->
  |     <metadata>
  |        <type-mapping>mySQL</type-mapping>
  |     </metadata>
  |   </local-tx-datasource>
  | </datasources>
  | 

On startup this file will be deployed, and now you can use it with ejb3 e.t.c

Cheers,

Andy

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4051226#4051226

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4051226



More information about the jboss-user mailing list