1 Reply Latest reply on Jul 19, 2003 12:54 PM by acristi

    Changing to Postgres

    joeyt

      Very new JBoss user, so hopefully someone can stick with me.

      JBoss 3.2.1 with Postgres 7.3.2. I copied the postgres-ds.xml over to the deploy directory, which looks like this:

      <?xml version="1.0" encoding="UTF-8"?>

      <!-- ===================================================================== -->
      <!-- -->
      <!-- JBoss Server Configuration -->
      <!-- -->
      <!-- ===================================================================== -->

      <!-- $Id: postgres-ds.xml,v 1.1 2002/07/22 22:57:24 d_jencks Exp $ -->
      <!-- ==================================================================== -->
      <!-- Datasource config for Postgres -->
      <!-- ==================================================================== -->



      <local-tx-datasource>
      <jndi-name>PostgresDS</jndi-name>
      <connection-url>jdbc:postgresql://localhost:5432/JBOSS</connection-url>
      <driver-class>org.postgresql.Driver</driver-class>
      <user-name>jtrdinich</user-name>
      thinkingman
      </local-tx-datasource>




      I then changed the beginning of standardjbosscmp-jdbc.xml to:

      <jbosscmp-jdbc>


      java:/PostgresDS
      <datasource-mapping>PostgreSQL</datasource-mapping>

      And the beginning of standardjaws.xml to:


      java:/PostgresDS
      <type-mapping>PostgreSQL</type-mapping>
      false


      I also copied the postgres jdbc driver to the lib directory. It seems that jboss is connecting to postgres, but still using hypersonic for all of the data. What am I missing?

      Thanks in advance

        • 1. Re: Changing to Postgres
          acristi

          I have the same configuration and it works great. Did you use in defaults body standardjbosscmp-jdbc.xml:


          java:/jdbc/NetBizDS
          <datasource-mapping>PostgreSQL 7.2</datasource-mapping>

          <create-table>true</create-table>
          <remove-table>false</remove-table>
          <read-only>false</read-only>
          <time-out>300</time-out>
          <pk-constraint>true</pk-constraint>
          <fk-constraint>true</fk-constraint>
          <row-locking>true</row-locking>
          <preferred-relation-mapping>foreign-key</preferred-relation-mapping>
          <read-ahead>
          on-load
          <page-size>1000</page-size>
          <eager-load-group>*</eager-load-group>
          </read-ahead>
          <list-cache-max>1000</list-cache-max>

          <unknown-pk>
          <key-generator-factory>UUIDKeyGeneratorFactory</key-generator-factory>
          <unknown-pk-class>java.lang.String</unknown-pk-class>
          <jdbc-type>VARCHAR</jdbc-type>
          <sql-type>VARCHAR(32)</sql-type>
          </unknown-pk>

          <entity-command name="default"/>



          You should use <datasource-mapping>PostgreSQL 7.2</datasource-mapping> ... it's type mapping is defined somewhere down to the end of file. Do not change their order!

          JBoss uses Hypersonic for JMS. In order to use PostgreSQL in your EJBs you have to specify in ejb deployment files this datasource and datasource-mapping ... (PostgreSQL 7.2)