Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

uPortal

...

  1. Put the JDBC driver .jar in the lib/container-common directory of your uPortal build environment
  2. Run ant deploy, which is the uPortal build command that will copy this .jar from that lib/container-common directory to the common directory of your container. Currently the only supported container is Tomcat, and this directory is {tomcat}/common/lib .
  3. Verify that the JDBC driver actually made it to the Tomcat common/lib directory.

If you put the driver in lib/container-shared which publishes it to {tomcat}/shared/lib then it will be "shared" among the web applications but not "common" between the web applications and the Tomcat container, and so Tomcat will struggle to instantiate the DataSources if you declare them as JNDI-published resources via your context descriptor file (typically, uPortal.xml). Now, you don't have to use JNDI, so this configuration can even work, but you will likely save yourself a great deal of trouble if you install the JDBC driver .jar into the common/lib directory rather than the shared/lib directory.

In uPortal 2.5.x and earlier

You will need to put the jdbc driver .jar in the lib directory of your uPortal build environment, update build.properties to adjust the definition of the "jdbcDriver.jar" property, and run ant deploy to get the uportal build to publish the .jar into {tomcat}/common/lib as aboveuses Maven for dependency management. To add your JDBC driver you need to know the Maven groupId, artifactId and version for the JAR and add this information to the /uPortal/uportal-impl/pom.xml file. The PostgreSQL example below can be followed for any JDBC driver that can be found in the central Maven repository, this includes most open source JDBC drivers. The Oracle example below can be followed for any JDBC driver that cannot be found in the central Maven repository, this includes most closed-source JDBC drivers.

Example using PostgreSQL

The first step is to determine the correct information to use in the pom. Using a Maven Artifact Search Site and searching for "postgres" we find the following Maven dependency declaration here.

Code Block
xml
xml

<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>8.2-507.jdbc4</version>
</dependency>

Opening /uPortal/uportal-impl/pom.xml there is a section about 20 lines down that reads:

Code Block
xml
xml

<!-- ***** Portal JDBC Driver *****
 | Add your JDBC Driver dependency here. If you are not using hsqldb you must change the scope
 | to test instead of just removing it as the driver is required for unit tests. 
 +-->
<dependency>
    <groupId>hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>${hsqldb.version}</version>
    <scope>compile</scope>
</dependency>

We will add the PostgreSQL driver here and do as the comment says and change the <scope> tag of the hsqldb driver to test.

Code Block
xml
xml

<!-- ***** Portal JDBC Driver *****
 | Add your JDBC Driver dependency here. If you are not using hsqldb you must change the scope
 | to test instead of just removing it as the driver is required for unit tests. 
 +-->
<dependency>
    <groupId>postgresql</groupId>
    <artifactId>postgresql</artifactId>
    <version>8.2-507.jdbc4</version>
</dependency>

<dependency>
    <groupId>hsqldb</groupId>
    <artifactId>hsqldb</artifactId>
    <version>${hsqldb.version}</version>
    <scope>test</scope>
</dependency>

Save the changes to /uPortal/uportal-impl/pom.xml and run "ant deploy-war" to deploy uPortal with your JDBC driver.