Howto change the DefaultDS in 4.0.4.GA
kurt_olsen Jun 17, 2006 5:06 AMAloha,
To change the default datasource For 4.0.4.GA you can try this:
I installed jboss using the installer.jar, and selected the ejb3-clustered profile which I subsequently renamed as 'all'
Delete jboss/server/all/deploy/hsqldb-ds.xml
Create a new datasource by copying the template for your specific database from jboss/docs/examples/jca to jboss/server/all/deploy
ie. COPY jboss/docs/examples/jca/mysql-ds.xml TO jboss/server/all/deploy/default-ds.xml
Edit default-ds.xml
Change the jndi-name to DefaultDS
Provide your connection parameters, username password etc
I used the same database name hsqldb-ds.xml used - 'localDB'
here is what I used for mysql
<datasources> <local-tx-datasource> <jndi-name>DefaultDS</jndi-name> <connection-url>jdbc:mysql://localhost:3306/localDB?createDatabaseIfNotExist=true</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>root</user-name> <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>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) --> <metadata> <type-mapping>mySQL</type-mapping> </metadata> </local-tx-datasource> </datasources>
Edit jboss/server/all/conf/standardjaws.xml
Change the type-mapping, in my case to 'mySQL'
Now we have to make jms happy by copying a specific template for your database from jboss/docs/examples/jms to jboss/server/all/deploy/jms
ie. COPY joss/docs/examples/jms/mysql-jdbc2-service.xml TO jboss/server/all/deploy/jms/mysql-jdbc2-service.xml
Edit the file file and change the datasource name it uses.
I had to change mine from MySqlDS to DefaultDS
Delete jboss/server/all/deploy/jms/hsqldb-jdbc2-service.xml
DO NOT delete hsqldb-jdbc-state-service.xml
I think it should be replaced but couldn't find a replacement.
I suspect that other changes might have to be made. After changing the performing this procedure I was able to sucessfully deploy one ejb3 entity and exercise it thru a stateless session bean.
The server boots without exceptions, the ejb3 deploys and works, and it used my database...
Does anybody know of anything else that should be done?