[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: .How can i change default databse Hypersonic to Mysql

vas_srinuin do-not-reply at jboss.com
Mon Apr 30 05:00:38 EDT 2007


Steps to changing default  Database Hypersonic to Mysql Database in Jboss


1.Download and set to the classpath the mysql driver (mysql-connector-java-5.0.4-bin.jar),
then copy this to [jboss-location]/server/default/lib directory.

2.Copty  file named mysql-ds.xml([jboss-location]/ docs/examples/jca/) into the
[jboss-location]/server/default/deploy/ directory and edit IP Address,Driver Name,url ?.



  <local-tx-datasource>
    <jndi-name>MySqlDS</jndi-name>
    <connection-url>jdbc:mysql://127.0.0.1:3306/test</connection-url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <user-name>root</user-name>
    
    <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>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) -->
    
       <type-mapping>mySQL</type-mapping>
    
  </local-tx-datasource>


The important lines are the bolded ones, one is for the url used for connecting to the mysql server; if you didn't change the port it listens to, leave 3306. 'localhost' is the host where the mysql server is running, if is something other than this, change it to the ip to reflect it corectly. After the slash there's the name of the datatbase the driver would connect to by default (in my case, "OPA").
The <user-name> element is obviously for specifying the user name that should be used when trying to connect to the mysql server, and the  element is for its corresponding password. Make sure u've created the user before testing the connection and have assigned that user with the rights for your above mentioned database. (see mysql manual for these operations :) )


3. copy the mysql-jdbc2-service.xml ([JbossLocation]\docs\examples\jms\mysql-jdbc2-service.xml) into D:/[JbossLocation]/server/default/deploy/jms/ and change the name (line no 58)DefaultDS to MySqlDS

4.copy the mysql-jdbc-state-service.xml into [JbossLocation]/server/default/deploy/jms/
   and change the name(line no 15) DefaultDS to MySqlDS
 
note:if u did?t found the mysql-jdbc-state-service.xml go to [JbossLocation]/server/default/deploy/jms/ and reaname the hsqldb-jdbc-state-service.xml to the mysql-jdbc-state-service.xml 
 



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

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



More information about the jboss-user mailing list