5 Replies Latest reply on Jun 2, 2006 5:27 PM by Weston M. Price

    How do I add Posgres 8 to JBoss 4.x

    Eric Ray Novice

      There is literally no information describing the procedure for using another datasource other the Hypersonic. I'm new to JBoss and J2EE programing so details are good.

      All I've found so far is to create a postgres-ds.xml file and put it in the /deploy directory. I've seen references to postgres-service.xml, but where does it go and what goes in it. Finally, how do I tell JBoss to read these files instead of the hsqldb-ds.xml file and related files. I've looke at the mbean for datasource but don't know how to manage it.

      Thanks for any help.

        • 1. Re: How do I add Posgres 8 to JBoss 4.x
          Weston M. Price Master

          Ok, lets take one thing at a time:

          I am assuing that you don't want to replace the default datasource, but rather, use one of your own.

          This is a good place to start for DataSources and JCA in general in JBoss

          http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossJCA

          DataSources and specficially mentioned here:

          http://wiki.jboss.org/wiki/Wiki.jsp?page=ConfigDataSources

          Both of these are mentioned in the READ THIS FIRST post at the top of this forum.

          • 2. Re: How do I add Posgres 8 to JBoss 4.x
            Eric Ray Novice

            From what I read this is what I do...

            place this (postgres-ds.xml) file in deploy-hasingleton

            <?xml version="1.0" encoding="UTF-8" ?>
            - <!-- =====================================================================
             -->
            - <!--
             -->
            - <!-- JBoss Server Configuration
             -->
            - <!--
             -->
            - <!-- =====================================================================
             -->
            - <!-- $Id: postgres-ds.xml,v 1.3.2.1 2006/02/07 14:23:00 acoliver Exp $
             -->
            - <!-- ====================================================================
             -->
            - <!-- Datasource config for Postgres
             -->
            - <!-- ====================================================================
             -->
            - <datasources>
            - <local-tx-datasource>
             <jndi-name>PostgresDS</jndi-name>
             <connection-url>jdbc:postgresql://localhost:5432/test</connection-url>
             <driver-class>org.postgresql.Driver</driver-class>
             <user-name>dev</user-name>
             <password>dev</password>
            - <!-- sql to call when connection is created. Can be anything, select 1 is valid for PostgreSQL
             <new-connection-sql>select 1</new-connection-sql>
            
             -->
            - <!-- sql to call on an existing pooled connection when it is obtained from pool. Can be anything, select 1 is valid for PostgreSQL
             <check-valid-connection-sql>select 1</check-valid-connection-sql>
            
             -->
            - <!-- corresponding type-mapping in the standardjbosscmp-jdbc.xml (optional)
             -->
            - <metadata>
             <type-mapping>PostgreSQL 8.0</type-mapping>
             </metadata>
             </local-tx-datasource>
             </datasources>


            place the postgres jdbc driver in server/all/lib

            When I start JBoss I see the following in the output:

            15:47:53,515 INFO [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=PostgresDS' to JNDI name 'java:PostgresDS'


            Is that all there is too it? If so great, I'm ready to rock-n-roll and thanks for the help. If there's more, please let me know.

            Thanks for the quick response.

            • 3. Re: How do I add Posgres 8 to JBoss 4.x
              Weston M. Price Master

              Yep, that's pretty much it. If you read the Wiki pages, you will find varying ways to fine tune the pools as you see fit (transactions, min/max size, etc, etc)

              Regards,

              Weston

              • 4. Re: How do I add Posgres 8 to JBoss 4.x
                Eric Ray Novice

                You are the man. Thanks so much. I'll shut up now. :)

                • 5. Re: How do I add Posgres 8 to JBoss 4.x
                  Weston M. Price Master

                  Nope, don't shut up!

                  Any question, comments etc, etc are always welcome.