I have had the same a few times: configuring jboss to use mysql as default 
database, so I wrote a simple ant task

Not sure if 4.2 is complete, it worked well for 4.0.2 (I made a few changes, 
for 4.2 standardjaws has been replaces by standardjbosscmp-jdbc) but the server 
starts without a error.

have funnn


  | <?xml version="1.0"?>
  | 
  | <project name="mysql" default="mysql" basedir=".">
  | 
  |     <property name="jboss_home" value="/Applications/jboss-4.2.0.GA/"/>
  |     <property name="server_conf" value="server/default"/>
  |     <property name="dburl" value="jdbc:mysql://localhost/jboss"/>
  |     <property name="dbuser" value="jboss"/>
  |     <property name="dbpassword" value="jboss"/>
  |     <property name="mysql_lib_dir" 
value="/Users/jahoo/dev/testsvn/resources/lib12GA"/>
  |     <property name="mysql_file" value="mysql-connector-java-5.0.5-bin.jar"/>
  | 
  |     <target name="mysql"
  |             description="does change mysql to standard db">
  |     <copy file="${mysql_lib_dir}/${mysql_file}" 
tofile="${jboss_home}/${server_conf}/lib/${mysql_file}"/>
  |         <delete file="${jboss_home}/${server_conf}/deploy/hsqldb-ds.xml"/>
  |         <copy file="${jboss_home}/docs/examples/jca/mysql-ds.xml" 
tofile="${jboss_home}/${server_conf}/deploy/mysql-ds.xml"/>
  |         <replaceregexp 
file="${jboss_home}/${server_conf}/deploy/mysql-ds.xml"  match="MySqlDS" 
replace="DefaultDS"/>
  |         <replaceregexp 
file="${jboss_home}/${server_conf}/deploy/mysql-ds.xml"  
match="<connection-url>.*</connection-url>" 
replace="<connection-url>${dburl}</connection-url>"/>
  |         <replaceregexp 
file="${jboss_home}/${server_conf}/deploy/mysql-ds.xml"  match="user-name>.*<" 
replace="user-name>${dbuser}<"/>
  |         <replaceregexp 
file="${jboss_home}/${server_conf}/deploy/mysql-ds.xml"  match="password>.*<" 
replace="password>${dbpassword}<"/>
  |         <replace 
file="${jboss_home}/${server_conf}/conf/standardjbosscmp-jdbc.xml"  
token="<type-mapping>Hypersonic SQL</type-mapping>" 
value="<type-mapping>mySQL</type-mapping>"/>
  |         <replace 
file="${jboss_home}/${server_conf}/conf/standardjbosscmp-jdbc.xml"  
token="<fk-constraint>false</fk-constraint>" 
value="<fk-constraint>true</fk-constraint>"/>
  |     <delete 
file="${jboss_home}/${server_conf}/deploy/jms/hsqldb-jdbc2-service.xml"/>
  |     <delete 
file="${jboss_home}/${server_conf}/deploy/jms/hsql-jdbc2-service.xml"/>
  |         <copy 
file="${jboss_home}/docs/examples/jms/mysql-jdbc2-service.xml" 
tofile="${jboss_home}/${server_conf}/deploy/jms/mysql-jdbc2-service.xml"/>
  |         <replace 
file="${jboss_home}/${server_conf}/deploy/jms/mysql-jdbc2-service.xml" 
token="MySqlDS" value="DefaultDS" />
  |         <replace file="${jboss_home}/${server_conf}/conf/login-config.xml" 
token="<policy>">
  |        <replacetoken><![CDATA[<policy>
  | <application-policy name = "MySqlDbRealm">
  |     <authentication>
  |         <login-module code = 
"org.jboss.resource.security.ConfiguredIdentityLoginModule" flag = "required">
  |             <module-option name = "principal">jboss</module-option>
  |             <module-option name = "userName">jboss</module-option>
  |              <module-option name = "password">jboss</module-option>
  |             <module-option name = 
"managedConnectionFactoryName">jboss.jca:service=LocalTxCM,name=DefaultDS</module-option>
  |         </login-module>
  |     </authentication>
  | </application-policy>
  | ]]></replacetoken>
  |    </replace>
  | </target>
  | </project>
  | 

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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054967
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to