Version 28

    Switch to a different database

    The page describes the steps to move from using the default hypersonic database to postgres. These steps should be the same for any other database aswell. Just replace postgres with the database you want to switch to.

     

    Step by step

    1. Remove deploy/hsqldb-ds.xml and add the following in a file named deploy/postgres-ds.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <datasources>
      <local-tx-datasource>
        <jndi-name>DefaultDS</jndi-name>
        <connection-url>jdbc:postgresql://host:port/database</connection-url>
        <driver-class>org.postgresql.Driver</driver-class>
        <user-name>username</user-name>
        <password>password</password>
          <metadata>
             <type-mapping>PostgreSQL 7.2</type-mapping>
          </metadata>
        <check-valid-connection-sql>select count(*) from jbm_user</check-valid-connection-sql>
      </local-tx-datasource>
    </datasources>
    

    Modify the above to suite your needs, connection parameters and such. Make sure the name of the DS is the same though(DefaultDS)

     

     

     

    2. Replace deploy/jbossesb.sar/juddi-ds.xml with the same configuration in the previous step (change the database name if needed).

     

    Again make sure the keep the jndi-name(juddiDB).

     

     

     

     

    3. Replace deploy/jbossesb.esb/message-store-ds.xml with the same configuration in step one (change the database name if needed).

     

    Again make sure the keep the jndi-name(JBossESBDS).

     

     

     

     

    4. Replace the database name in the 'message-store-sql' element in deploy/jbossesb.esb/jbossesb-service.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    
    <server>
       <mbean code="org.jboss.internal.soa.esb.dependencies.DatabaseInitializer"
           name="jboss.esb:service=MessageStoreDatabaseInitializer">
          <attribute name="Datasource">java:/JBossESBDS</attribute>
          <attribute name="ExistsSql">select * from message</attribute>
          <attribute name="SqlFiles">
             message-store-sql/postgresql/create_database.sql
          </attribute>
          <depends>jboss.jca:service=DataSourceBinding,name=JBossESBDS</depends>
       </mbean>
    </server>
    

    5. Edit deploy/jbossesb.sar/esb.juddi.xml, and verify that it has a section that looks like this:

        <entry key="juddi.isUseDataSource">true</entry>
    
        <!-- jUDDI DataSource to use -->
        <entry key="juddi.dataSource">java:/juddiDB</entry>
    
        <!-- jUDDI database creation -->
        <entry key="juddi.isCreateDatabase">true</entry>
    
        <!--   <entry key="juddi.tablePrefix">JUDDI_</entry> -->
       <entry key="juddi.databaseExistsSql">select * from ${prefix}BUSINESS_ENTITY</entry>
    
       <entry key="juddi.sqlFiles">juddi-sql/postgresql/create_database.sql,juddi-sql/postgresql/import.sql</entry>
    

     

    6. Replace deploy/jboss-messaging/hsqldb-persistence-service.xml with the postgres-persistence-service.xml from the version of JBM that you are running.

     

    This needs to match the same version and might not work it the versions mismatch. These files can be found in src/etc/server/default/deploy of a JBM distribution.

     

    Note that we have had reports of users trying this with AS 5 and having problems. Please see the previous link to a discussion and solution if you are having problems.

     

     

    7. Copy the database driver to the servers lib directory and fire up the server.

     

     

     

     

     

    -