Step 1: Configure the Database Filter
- From the uPortal source directory, open the uPortal-4.x.x/filters/local.properties file and add your database information
## HSQL Configuration environment.build.hsql.port=8887 ## Database Connection Settings (Uncomment the Maven Filters section in rdbm.properties) environment.build.hibernate.connection.driver_class=com.microsoft.sqlserver.jdbc.SQLServerDriver environment.build.hibernate.connection.url=jdbc:sqlserver://<servername>:<port>;databaseName=<databasename> environment.build.hibernate.connection.username=username environment.build.hibernate.connection.password=password environment.build.hibernate.dialect=org.hibernate.dialect.SQLServerDialect environment.build.hibernate.connection.validationQuery=select 1
Step 2: Add the database driver
NEW: Open uportal-db/pom.xml file, uncomment the MSSQL sqljdbc driver below and modify as needed
- Add the appropriate version properties to the root pom.xml file or enter the appropriate version below
uportal-db/pom.xml
... <dependencies> <!-- Add any db drivers that are applicable to *any* of your environments --> <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>${hsqldb.version}</version> <scope>compile</scope> </dependency> <!-- | The following db drivers should be uncommented and/or modified as needed for server | deployments. (Add all thaat are needed.) Don't forget to add appropriate .version | properties to the root pom.xml, or simply enter the appropriate version below. +--> <!-- <dependency> <groupId>postgresql</groupId> <artifactId>postgresql</artifactId> <version>${postgres.version}</version> <scope>compile</scope> </dependency> <dependency> <groupId>com.ibm.db2</groupId> <artifactId>db2-jdbc</artifactId> <version>${db2.version}</version> <scope>compile</scope> </dependency> --> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>sqljdbc4</artifactId> <version>${mssql.version}</version> </dependency> <!-- <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql.version}</version> </dependency> <dependency> <groupId>com.oracle</groupId> <artifactId>ojdbc6_g</artifactId> <version>${oracle.version}</version> </dependency> <dependency> <groupId>org.sybase</groupId> <artifactId>sybase-jconnect</artifactId> <version>${sybase.version}</version> </dependency> --> </dependencies>
Step 3: Test the Configuration
Running the dbtest
ant target will tell you if you have configured the database connection properly.
ant dbtest
Step 4: Build and Deploy
Following a successful test, you can execute the command below to build the database tables and copy files to your servlet container.
ant clean initportal
Step 5: Restart Tomcat