8 Replies Latest reply on Oct 22, 2003 8:17 AM by praveenkushwaha

    [newbie] Howto connect JBoss to PostgreSQL

    pengster Newbie

      Hi gurus,

      Has anyone been using PostgreSQL with JBoss?
      Any help in configuring them to work together would be much appreciated.

      I'm using JBoss 3.0.7, PostgreSQL 7.3.3 on Windows XP and the JDBC driver pg73jdbc3.jar

      Thanks in advance

        • 1. Re: [newbie] Howto connect JBoss to PostgreSQL
          Juha Lindfors Master

          The datasource config from the JBoss examples pretty much works as is. Just make sure you enable TCP/IP connections to your database (postmaster -i).

          • 2. Re: [newbie] Howto connect JBoss to PostgreSQL
            Stephen Huang Newbie

            I did some simple test for Jboss 3.2.1 + PostgreSQL 7.3.2
            Here is the major JBOSS related steps:
            1. Delete or rename the hsqldb-ds.xml
            2. copy docs\example\jca\postgres-ds.xml to "deploy" folder, modify it like this:
            (assume using database "mydb" locally)

            <?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>DefaultDS</jndi-name>
            <connection-url>jdbc:postgresql://localhost:5432/mydb</connection-url>
            <driver-class>org.postgresql.Driver</driver-class>
            <user-name>postgres</user-name>

            </local-tx-datasource>




            3. Modify the conf\standardjbosscmp-jdbc.xml liek this:
            (change "Hypersonic SQL" to "PostgreSQL")

            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jbosscmp-jdbc>

            <!-- ===================================================================== -->
            <!-- -->
            <!-- Standard JBossCMP-JDBC Configuration -->
            <!-- -->
            <!-- ===================================================================== -->

            <!-- $Id: standardjbosscmp-jdbc.xml,v 1.39.2.14 2003/05/03 11:03:40 slaboure Exp $ -->

            <jbosscmp-jdbc>


            java:/DefaultDS
            <datasource-mapping>PostgreSQL</datasource-mapping>
            .....

            • 3. Re: [newbie] Howto connect JBoss to PostgreSQL
              Gordon Luk Newbie

              Hi,

              Had you successful connect to postgrsql other than "DefaultDS"? If yes, could you post the sample config to us? Thanks.

              Gordon

              • 4. Re: [newbie] Howto connect JBoss to PostgreSQL
                leninkoduru Newbie

                Yes i am using Postgres with Jboss.Here is the configuration file srequired for it.See the attachments.

                postgres-ds.xml file should be in your server/default/deploy directory.

                • 5. Re: [newbie] Howto connect JBoss to PostgreSQL
                  Gordon Luk Newbie

                  Thanks for your help first.

                  Yes, its work when i just use single datasource, i can found jboss open up connection pool according my config as postgres-ds.xml.

                  But when i put the default one ( hsqldb-ds.xml) back... jboss hadn't open postgresql side connection pool for me.

                  I attach a few config files for ref.

                  Little bit different to yours, just i add more attribit to postgres-ds.xml to define the min/max pool size and standardjbosscmp-jdbc.xml point to PostgresSQL 7.2 for mapping.

                  Please have a look and give me a hand. Thanks a lot.

                  • 6. Re: [newbie] Howto connect JBoss to PostgreSQL
                    rsrawat Newbie

                    Hi
                    If anyone from you who got successful in connecting JBoss to Postgres could post ejb-jar.xml , jboss.xml and jbosscmp-jdbc.xml file for CMP Entity Bean.
                    I am trying my best to communicate between these but do not know where I am making mistake. If anyone can post these sample files for me. I will be very thankful.
                    Thanks in Advance.

                    • 7. Re: [newbie] Howto connect JBoss to PostgreSQL
                      pauster007 Newbie

                      > Hi
                      > If anyone from you who got successful in connecting
                      > JBoss to Postgres could post ejb-jar.xml , jboss.xml
                      > and jbosscmp-jdbc.xml file for CMP Entity Bean.
                      > I am trying my best to communicate between these but
                      > do not know where I am making mistake. If anyone can
                      > post these sample files for me. I will be very
                      > thankful.
                      > Thanks in Advance.
                      >

                      yes any kind hearted souls out there? pls post or attach the said xml files...some newbies here need some help...

                      • 8. Re: [newbie] Howto connect JBoss to PostgreSQL
                        praveenkushwaha Newbie

                        hi
                        guys
                        i am using postgresql7.2 anf jboss3.2.2
                        but i am getting error i think in jndi name
                        i am atting the details of error ( a part of it)