MSSQL with the jTDS JDBC Driver

About Microsoft SQL Server

Microsoft SQL Server (MSSQL) is a commercial database product available from Microsoft
Further technical information on this product may be found here

Important Warning

Adopters running uPortal 3 on MS SQL Server should enable the ALLOW_SNAPSHOT_ISOLATION and READ_COMMITTED_SNAPSHOT options in the portal database. Perform the following commands to enable these settings:

ALTER DATABASE MyDatabase
SET ALLOW_SNAPSHOT_ISOLATION ON

ALTER DATABASE MyDatabase
SET READ_COMMITTED_SNAPSHOT ON

Without these options, MS SQL Server will encounter deadlocks in the portlet preferences subsystem under load. You can read more about these settings here.

Obtaining a Driver

Since the jTDS JDBC driver for MSSQL is not available in the central Maven repository, it must be placed into the local repository of each machine on which you wish to build uPortal.

As an alternative to this, you could set up a maven repository for use by multiple machines.

The first step is to download the JDBC driver for your database. The preferred driver is the jTDS driver from sourceforge. It can be obtained here.

To install the JAR into your local maven repository, use the following command:

mvn install:install-file -DgroupId=net.sourceforge -DartifactId=jtds -Dversion=1.2 -Dpackaging=jar -DgeneratePom=true -Dfile=jtds-1.2.jar

The groupId, artifactId and version specified in this command are up to you, but they should match the JAR vendor, name and version to avoid confusion down the road.

JAR Configuration

Opening /uPortal/pom.xml, there is a section about 110 lines down that reads:

    <!-- The JDBC Driver used by uPortal -->
    <jdbc.groupId>hsqldb</jdbc.groupId>
    <jdbc.artifactId>hsqldb</jdbc.artifactId>
    <jdbc.version>${hsqldb.version}</jdbc.version>

Modify this to use the MSSQL driver, using the group, artifact and version information from the mvn install:install-file command above.

    <!-- The JDBC Driver used by uPortal -->
    <jdbc.groupId>net.sourceforge</jdbc.groupId>
    <jdbc.artifactId>jtds</jdbc.artifactId>
    <jdbc.version>1.2</jdbc.version>

See Issues section about possible issues using this driver.

JDBC Configuration

Edit /uPortal/uportal-impl/src/main/resources/properties/rdbm.properties by adding the following information for MSSQL, modifying the url, username and password as appropriate:

##### Microsoft SQL Server
hibernate.connection.driver_class=net.sourceforge.jtds.jdbc.Driver
hibernate.connection.url=jdbc:jtds:sqlserver://my.school.edu:1433/uPortal3db
hibernate.connection.username=test
hibernate.connection.password=mypass
hibernate.dialect=org.hibernate.dialect.SQLServerDialect

Testing the Configuration

Running the dbtest ant target will tell you if you have configured the database connection properly.

ant dbtest

Then, following a successful test, you can execute

ant initportal

to build the database tables and copy files to your servlet container.

Issues and Known Bugs

Additional Notes

An alternative JDBC driver is available directly from Microsoft at: http://msdn.microsoft.com/en-us/data/aa937724.aspx

Credits

Much of the information on this page was provided by Bikrant Neupane on the uportal-user list. Thanks.

Having problems with these instructions?

Please send us feedback at uportal-user@lists.ja-sig.org