Configuring for PostgreSQL

Setting up the databases required by Pentaho 

Pentaho requires 3 databases which are more or less mandatory. These are:

Database

Description

Sql Script

Mandatory

Shark

Used for bursting and similar tasks

PentahoDoc:Shark.sql

YES

Quartz

Database which is the main pentaho scheduler (think about it as a cron-like tool that stores its cron jobs in the database)

PentahoDoc:Quarz.sql

YES

Hibernate

The persistence layer used by pentaho

hibernate.sql

YES

sampledata

If you are on production you may not need it, but you will need it for demonstration and seeing what is new in Pentaho.

sampledata.sql

No

Please note that the sql files above REQUIRES you to edit them since the database are created and are owned by the tomcat user. So, if you dont have another user in PostgreSQL who you want to use then you will have to replace every occurrence of tomcat with your own user before importing the files.

One point I would like to add is how I have created this SQL files: first I converted them from HSQLDB to MySQL and then from MySQL to PostgreSQL. It was a bit painfull process, but now Pentaho works and that's good. Please be warned that the sampledata is not 100% well converted so you may encounter some problem with it. This is a task that still needs to be done to finalize the sampledata.

loading the data into postgresql:

Create the above empty databases. Assuming your user is tomcat you would do that as following:

postgres@anfatech:~$ createdb shark -O tomcat
postgres@anfatech:~$ createdb quartz -O tomcat
postgres@anfatech:~$ createdb hibernate -O tomcat
postgres@anfatech:~$ createdb sampledata -O tomcat

 and import the scripts above into the appropriate database as following

tomcat@anfatech:~$ psql -U tomcat -d hibernate < hibernate.sql
tomcat@anfatech:~$ psql -U tomcat -d quartz < quartz.sql
tomcat@anfatech:~$ psql -U tomcat -d shark < shark.sql
tomcat@anfatech:~$ psql -U tomcat -d hibernate < sampledata.sql

Now your PostgreSQL should be ready. The next step is to configure the datasources required to access the data.

You can use my settings as an example: PentahoDoc:samples for jboss

 sorry for the dead link (my homepage has been token over) now i uploaded the templates to the wiki so they should be fine there!

Configuring pentaho's datasources for Tomcat 5.5.x and Higher, using context.xml

if you plan to deploy on tomcat then you better use what tomcat offers you:

instead of messing with config files in conf/server.xml  or even worse creating a file under $CATALINA_HOME/conf/Catalina/localhost/yourApplication.xml

you could use what tomcat expects in your Application archive

 pentaho
|-- META-INF
|   `-- context.xml  <---(***1***)
`-- WEB-INF
    `-- web.xml

(**1*): this file "context.xml" will be processed by tomcat *at deployment time and if you define your datasources there, tomcat
will do the necessary configurations for you.

An example of a valid context.xml file should be looking like the following one:

<Context     path="/pentaho"
               docBase="path/to/pentaho" <---(***2***)
               debug="5"
               reloadable="true"
               crossContext="true">   
    <Resource   name="jdbc/Quartz"
                auth="Container"
                type="javax.sql.DataSource"
                maxActive="100"
                maxIdle="30"
                maxWait="10000"
                username="username"
                password="password"  
                driverClassName="org.postgresql.Driver"
                url="jdbc:postgresql://localhost:5432/target-database"/>   
<!--
    You can add as many datasources as you need here

-->
</Context>

(**2**) : if you deploy your application to tomcat default webapps so your docbase shoud be like the following one:

      docBase="${catalina.home}/webapps/pentaho

when you finished creating your context.xml you can then package your war and deploy it to tomcat. the context.xml of your application will get converted to applicationName.xml for the application name pentaho as shown above the resulting file will be this one:

 $CATALINA_HOME/conf/Catalina/localhost/pentaho.xml

if your database are correctly set and everything went fine pentaho should be able to access the databases using the datasource defined in the context.xml

Make sure your driver is in the right location and startup your application server where Pentaho is deployed.

Configuring the Quartz Scheduler:

go to the file solution/system/quartz/quartz.properties and change the line and search for the property "
org.quartz.jobStore.driverDelegateClass".  Change that line so that it reads:

org.quartz.jobStore.driverDelegateClass = org.quartz.impl.jdbcjobstore.PostgreSQLDelegate