r3 - 19 Oct 2006 - 13:37:58 - VinubalajiGopalYou are here: OSAF >  Journal Web  > CosmoPostgreSQL

Cosmo with PostgreSQL

Cosmo can work with any database by just modifying some configurations in the snarf (the build system) and the applicationContext file. Here are the steps to configure Cosmo with a PostgreSQL database, but similar steps can be followed to configure Cosmo with any database.

To setup postgresql, login as postgres

#bash# su postgres
#bash# psql
postgres-# create user test with password test;
postgres-# create database cosmo owner test;

The above command

  • creates a user test with password test
  • creates a database named cosmo with the owner being test.

Modify the server.xml file to have PostgreSQL? configured in Cosmo:

  • server.xml can be found at $COSMOSRC/src/main/config/server.xml if you have not built snarf yet
  • $COSMOSRC/dist/osaf-server-bundle-0.5-SNAPSHOT/tomcat/conf/server.xml - If you have already built snarf and dont want to rebuild snarf

Modify the Resource section by commenting out the derby section and adding the following lines for postgresql

<!-- <Resource name="osafsrv/db"
              type="javax.sql.DataSource"
              maxActive="100"
              maxIdle="30"
              maxWait="10000"
              username="sa"
              password=""
              driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
              url="jdbc:derby:db;create=true"/>  -->

<Resource name="osafsrv/db"
             type="javax.sql.DataSource"
             driverClassName="org.postgresql.Driver"
             url="jdbc:postgresql://localhost/cosmo"
             username="test"
             password="test"
             maxActive="100"
             maxIdle="30"
             maxWait="10000"/>

  • Modify applicationContext.xml file to include postgresql for hibernate. ($COSMOSRC/src/main/resources/applicationContext.xml)

<!--        <prop key="hibernate.dialect">org.hibernate.dialect.DerbyDialect</prop> -->
  <!--      <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop> -->
        <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>

Rebuild Cosmo and everything should work.

Links

PostgreSQL Manual

-- VinubalajiGopal - 19 Oct 2006

Edit | WYSIWYG | Attach | Printable | Raw View | Backlinks: Web, All Webs | History: r3 < r2 < r1 | More topic actions
 
Open Source Applications Foundation
Except where otherwise noted, this site and its content are licensed by OSAF under an Creative Commons License, Attribution Only 3.0.
See list of page contributors for attributions.