Follow these instructions to configure your Liferay portal with Derby DB SGBD :
- Downloading the jdbc driver
Liferay don’t provide natively a Derby DB jdbc driver. You must download it. Follow these instructions to download it :
- Go to the official Apache Derby db download page
- Click on the appropriate latest official release
- On the distributions part, click on the db-derby-***-bin.zip link as shown below :
- Unzip the downloaded archive and navigate to “lib” folder
- Copy derby.jar and past it under $TOMCAT_HOME/lib/ext
- Creating the blank database
Connect to your derby DB and create a database called lportal. You can do it by following these commands :
- Open a command terminal and navigate to the folder where you want to create your database. In our example, I will create a database under C:\dev\derbyDB. So in your prompt, tape :
1cd C:\dev\derbyDB - Launch the ij tool by taping :
1java org.apache.derby.tools.ij - Create a lportal database by taping :
1connect 'jdbc:derby:lportal;create=true';
- Updating portal-ext.properties
Open your portal-ext.properties file and fill with this information:
1 2 3 4 5 |
# DerbyDB jdbc.default.driverClassName=org.apache.derby.jdbc.EmbeddedDriver jdbc.default.url=jdbc:derby:lportal jdbc.default.username=sysdba jdbc.default.password=masterkey |
The default login/password of an Apache Derby Database are sysdba/masterkey.
- Adding the JVM Argument
With Apache Derby database, we have to tell the server where the database is located. To do that, add the argument -Dderby.system.home=”<YOUR_DERBY_DATABASE_LOCATION>” to the jvm.
If you are handling your server under Eclipse, follow these instructions :
- On the server view, Double click on your server
- On the “Overview“ window, under “General Information”, click on “Open launch configuration”
3. Go to “Arguments” tab, and in the “VM arguments“ section, add this line :
1-Dderby.system.home=”<YOUR_DERBY_DATABASE_LOCATION>”
Important: Don’t use ” \” or ”/” at the end of the path to your database.
- Check the configuration:
During the server start, you can verify that Liferay started with the correct dialect (Apache Derby) by looking for the following line in your server log console/file:
1 2 |
21:29:04,296 INFO [localhost-startStop-1][DialectDetector:71] Determine dialect for Apache Derby 10 21:29:04,357 INFO [localhost-startStop-1][DialectDetector:136] Found dialect org.hibernate.dialect.DerbyDialect |
If you go back to your database, you will see that it’s now populated by about 180 data tables that Liferay created on startup.
If you already configured your portal with hsql and want to re-configured it with the DerbyDB Database and add samples data, open portal-setup-wizard.properties file located in the same folder as portal-ext.properties. Set the setup.wizard.enabled to true and restart your server.