Overview of the process for switching to a different database

Here is a high-level overview of the steps involved in switching from the default Hypersonic database to the production RDBMS of your choice.

The details vary from database to database.

To switch to a different database:

  1. Install and verify that your database is working.
  2. Create a new empty database or schema for the application.

    When you create the new database, make sure to use UTF-8 encoding.

  3. Create a database user for the application.
  4. Grant that user access to the appropriate database/schema, with privileges to create tables, alter schemas, and so on in that database.

    Ensure that the user has remote access from the application servers.

  5. Stop Studio if it is running.
  6. Next, edit the JDBC section of the portal-ext.properties file to change the database connection from Hypersonic to your database.
    1. The default version of the file has the Hypersonic settings enabled. Comment out these settings.
      # Hypersonic
      #
      jdbc.default.driverClassName=org.hsqldb.jdbcDriver
      jdbc.default.url=jdbc:hsqldb:${eid.studio.home}/data/hsql/lportal
      jdbc.default.username=sa
      jdbc.default.password=
    2. To configure the connection to your database, the recommended option is to uncomment and configure the jdbc.default.jndi.name parameter.
      # Set the JNDI name to lookup the JDBC data source. If none is set,
      # then the portal will attempt to create the JDBC data source based on the
      # properties prefixed with "jdbc.default.".
      #
      #jdbc.default.jndi.name=jdbc/LiferayPool

      Using the JNDI name is more secure than providing the connection settings, which include the user name and password, in portal-ext.properties.

      If you do not use the JNDI name, Studio logs a warning.

      Before you can use the JNDI name, you must first configure a JDBC data source within your application server. The steps to configure a JDBC data source will vary based on your application server. See your application server documentation for details.

      Make sure that the value of jdbc.default.jndi.name matches exactly the JNDI name you assign to the data source.

  7. For a MySQL database, if users will be uploading custom images to use for application components, then you need to increase the value of the max-allowed-packet variable.

    The default is 1MB. However, Studio allows users to upload images up to 3MB. So you should change it to a value greater than 3MB, such as 4MB.

    If you do not change the value of the variable, then when users try to upload an image greater than 1MB, a JDBC error, "Packet for query is too large", is returned.

  8. Start Studio. Monitor the logs to check for error messages while Studio connects to the database and creates the tables.
  9. After the tables have been created and you have verified that Studio is running, you may remove the user's alter table privileges.

    Note that you may have to restore these later if you upgrade Studio or install components that require schema changes.