Orbeon Forms Postgres DB connection

Solution 1:

Once the database resource is configured, you can tell Orbeon to use it by adding a like like this to your properties-local.xml:

<property as="xs:string"  name="oxf.fr.persistence.provider.*.*.*" value="postgresql"/>

You can see the default configuration for the resource names Orbeon accepts out of the box in properties-form-runner.xml.

Exist will still be used for the example forms. But you can disable it with:

<property as="xs:boolean" name="oxf.fr.persistence.exist.active" value="false"/>

If you need to define a resource with a name other than the default names (e.g. postgresql), you will need to provide more information as shown below (remember to replace all occurances of pg_other_name with your resource name).

<property as="xs:string"  name="oxf.fr.persistence.provider.*.*.*" value="pg_other_name"/>
<property as="xs:anyURI"  name="oxf.fr.persistence.pg_other_name.uri" value="/fr/service/postgresql"/>
<property as="xs:string"  name="oxf.fr.persistence.pg_other_name.datasource" value="pg_other_name"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.create-flat-view" value="true"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.autosave" value="true"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.permissions" value="true"/>
<property as="xs:boolean" name="oxf.fr.persistence.pg_other_name.versioning" value="true"/>

Solution 2:

I'm not sure what you mean by "created context in the Server.xml".

In tomcat's server.xml you should have a datasource defined. For example:

<GlobalNamingResources>

    <Resource
        name="jdbc/postgresql"
        auth="Container"
        type="javax.sql.DataSource"
        initialSize="3"
        maxActive="10"
        maxIdle="20"
        maxWait="30000"
        driverClassName="org.postgresql.Driver"
        validationQuery="select 1"
        testOnBorrow="true"
        poolPreparedStatements="true"
        username="orbeon"
        password="orbeon"
        url="jdbc:postgresql://server:5432/database?useUnicode=true&amp;characterEncoding=UTF8&amp;socketTimeout=30&amp;tcpKeepAlive=true"/>

</GlobalNamingResources>

Then in tomcat's context.xml you should have a ResourceLink for the datasource:

<ResourceLink global="jdbc/postgresql" name="jdbc/postgresql" type="javax.sql.DataSource"/>

properties-local.xml should be either in webapps/orbeon/WEB-INF/resources/config or in an external directory you have defined in tomcat's context.xml, for example:

<Parameter name="oxf.resources.priority.0" override="false" value="org.orbeon.oxf.resources.FilesystemResourceManagerFactory"/>
<Parameter name="oxf.resources.priority.0.oxf.resources.filesystem.sandbox-directory" override="false" value="C:/orbeon_resources"/>

In that case the properties-local.xml should be here: C:\orbeon_resources\properties-local.xml. See Storing configurations outside of the Orbeon Forms war file.

Also, make sure you have performed the Orbeon Forms setup. That is general database configuration, not specific to postgresql or any other database implementation. The examples they give are for oracle but you can just replace oracle with postgresql.