Configure the Database
uPortal Default Database Configuration
uPortal is configured to use a file-based HSQL database by default. This database configuration is not suitable for production deployments and best used for testing purposes.
uPortal does support a number of popular production-class databases and you can configure the database by following the examples posted under uPortal Production Database Configuration.
Step 1: Configure the Database Filter
1. In the filters folder, locate the default local.properties file under uPortal-4.0.x/filters/local.properties and configure the Database Connection Settings
# HSQL Configuration environment.build.hsql.port=8887 # Database Connection Settings (Uncomment the Maven Filters section in rdbm.properties) environment.build.hibernate.connection.driver_class=org.hsqldb.jdbc.JDBCDriver environment.build.hibernate.connection.url=jdbc:hsqldb:hsql://localhost:${environment.build.hsql.port}/uPortal environment.build.hibernate.connection.username=sa environment.build.hibernate.connection.password= environment.build.hibernate.dialect=org.hibernate.dialect.HSQLDialect environment.build.hibernate.connection.validationQuery=select 1 from INFORMATION_SCHEMA.SYSTEM_USERS
Step 2: Deploying the database driver (4.0.x and earlier)
In addition to configuring the database connection information, changing uPortal databases also requires updating the deployed database driver.
This driver may be configured as a dependency in the main uPortal pom.xml file.
<jdbc.groupId>hsqldb</jdbc.groupId> <jdbc.artifactId>hsqldb</jdbc.artifactId> <jdbc.version>${hsqldb.version}</jdbc.version> ... <hsqldb.version>2.2.8</hsqldb.version>
Approach 1: Add separate dependency to your chosen database (recommended)
Use this approach if you want to use HSQLDB for a local, developer database but have a different database in your shared dev/test/prod systems.
- Search all pom.xml files in the entire project for the string "${jdbc.groupId}" and ADD your chosen database dependency under the generic ${jdbc.groupId} dependency. The example below uses mysql.
<dependency> <groupId>${jdbc.groupId}</groupId> <artifactId>${jdbc.artifactId}</artifactId> <version>${jdbc.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.25</version> <!-- better: define a property <mysql.version>5.1.25</mysql.version> in the main pom.xml and reference here as <version>${mysql.version}</version> --> </dependency>
If your installation has any non-bundled portlets (portlets not in uportal-portlets-overlay folder) that do database operations, also add the dependency to those portlet's pom.xml files.
Approach 2: Modifying the jdbc.* property values
Use this approach if you are not using HSQLDB for your local, developer database.
1. From the uPortal source directory, open the /uPortal-4.x.x/pom.xml file and add the following dependency:
< dependency > < groupId >mysql</ groupId > < artifactId >mysql-connector-java</ artifactId > < version >5.1.25</ version > </ dependency > |
If your installation has any non-bundled portlets (portlets not in uportal-portlets-overlay folder) that do database operations, also add the dependency to those portlet's pom.xml files.
2. Also, edit the jdbc settings in the pom.xml to replace hsqldb with your chosen database (mysql in example below).
<jdbc.groupId>hsqldb</jdbc.groupId> <jdbc.artifactId>hsqldb</jdbc.artifactId> <jdbc.version>${hsqldb.version}</jdbc.version> ... <hsqldb.version>2.2.8</hsqldb.version> to <jdbc.groupId>mysql</jdbc.groupId> <jdbc.artifactId>mysql-connector-java</jdbc.artifactId> <jdbc.version>5.1.25</jdbc.version>
Step 3: Testing the database configuration
To test your database configuration from the command-line:
ant dbtest
uPortal Production Database Configuration
Select the database below for notes and examples of configuration.
- DB2
- HypersonicSQL
- MS SQL Server and MS JDBC Driver (recommended)
- MSSQL with the jTDS JDBC Driver
- MySQL
- Oracle
- PostgreSQL
- Sybase SQL Server
- Using JNDI managed DataSources
Add Feedback content box here.....