Setting Up Liferay Portal on a DB2 Database

This article is a legacy article. It applies to previous versions of the Liferay product. While the article is no longer maintained, the information may still be applicable.

This article outlines steps on how to setup a DB2 connection with Liferay Portal. This article use properties set in the portal-ext.properties file, and not through the use of JNDI.

Resolution

  1. In the DB2 Control Center, create the appropriate database name, for example "lrdb". If using Portal 6.1.x, the page size of the created database should be 8k. The default value is 4k, and will not work for Liferay Portal 6.1.x
  2. Grant the appropriate permissions to the database user.
  3. Place the following properties in to portal-ext.properties file:
    jdbc.default.driverClassName=com.ibm.db2.jcc.DB2Driver
    
    jdbc.default.url=jdbc:db2://localhost:50000/lrdb:deferPrepares=false;fullyMaterializeInputStreams=true;fullyMaterializeLobData=true;progresssiveLocators=2;progressiveStreaming=2;
    
    jdbc.default.username=db2admin
    
    jdbc.default.password=lportal
    		
    
    custom.sql.function.isnull=CAST(? AS VARCHAR(32672)) IS NULL
    
    custom.sql.function.isnotnull=CAST(? AS VARCHAR(32672)) IS NOT NULL
    	
  4. Place the necessary DB2 driver JARs (db2jcc.jar, db2jcc_license_cu.jar) in the dependencies folder.
  5. Start up Liferay Portal.

Additional Information

The big difference with DB2 over other databases is the need for the custom.sql.function properties in portal-ext.properties file.

这篇文章有帮助吗?
0 人中有 0 人觉得有帮助