You are here: Installation > Advanced implementation > Deployment on an external database (RDBMS) > Upsize to an external database (RDBMS)

Upsize to an external database (RDBMS)

By default, PaperCut NG uses an internal database product known as Apache Derby. You might, however, consider running PaperCut NG on an external RDBMSA Relational database management system (RDBMS) is a program that lets you create, update, and administer a relational database. Most commercial RDBMS's use the Structured Query Language (SQL) to access the database, although SQL was invented after the development of the relational model and is not necessary for its use. if your organization:

  • has existing database infrastructure and wants to consolidate all applications on the same database platform.
  • has an existing database maintenance and backup procedure and wants PaperCut NG to take advantage of this.
  • uses 3rd party reporting and analysis tools (like Crystal Reports or Microsoft Access) to view and analyze the PaperCut NG database.
  • is very large and requires the performance benefits of a dedicated RDBMS. This also allows the database to reside on a separate server to PaperCut NG, which improves the system scalability.

The high-level steps to upsize the database are:

  1. Stop the PaperCut NG Application Server
  2. Perform a backup of the existing data
  3. Create a new database in the external RDBMS
  4. Configure the database
  5. Change the PaperCut NG connection details
  6. Initialize the new database
  7. Load the data into the new database
  8. Restart the application
Important:

Each Application ServerAn Application Server is the primary server program responsible for providing the PaperCut user interface, storing data, and providing services to users. PaperCut uses the Application Server to manage user and account information, manage printers, calculate print costs, provide a web browser interface to administrators and end users, and much more. requires exclusive access to an external database. i.e. A single database cannot be shared between more than one Application Server. If you are running multiple Application Servers (e.g. a test and production instance), then each must have a separate database.

Step 1: Stop the PaperCut NG Application Server

Stop the Application Server. This allows you to back up the data, guaranteeing that all data is saved and ready to load into the new database.

For more information, see Stop and start the Application Server.

Step 2: Perform a backup of the existing data

Perform a backup of the database. This data is loaded into the application in a later step. For more information, see Manage system backups.

To back up the database:

  1. On the Application Server, open a command prompt. (If you see 'Access Denied' errors, run the command prompt as an Administrator).

  2. On Linux or Mac, use su or equivalent to become the identity of papercut. e.g.

    Mac: sudo su - papercut

    Linux: su - papercut

  3. Change (cd) to the server binaries directory. e.g.

    Windows: cd "C:\Program Files\PaperCut NG\server\bin\win"

    Mac: cd "/Applications/PaperCut NG/server/bin/mac"

    Linux: cd ~papercut/server/bin/linux-*

  4. Run the following command:

    db-tools export-db

    The output of the above command shows the name of the backup file.

  5. Take note of the backup file name because it is required in a later step.

Step 3: Create a new database in the external RDBMS

This step differs depending on the external database you are using. It is assumed that the administrator knows how to create a new database. The following steps must be performed regardless of the chosen database:

  1. Create a new empty database for dedicated use by PaperCut NG. When creating the database, make sure you select the correct character encoding for your language.

    Important:

    Create the database with a character encoding suitable for your language. For SQLStructured Query Language (SQL) is a special-purpose programming language designed for managing data held in a relational database management system (RDBMS), or for stream processing in a relational data stream management system (RDSMS). Server, the character encoding is set in Collation on the new database screen. For other databases, such as PostgreSQL or MySQL, select a unicode character set (UNICODE or UTF8) that allows all possible characters to be stored.

  2. Create a new database user (and password) for PaperCut NG to use to connect to the database.

  3. Assign the appropriate permissions to the new user to give them full access to the new database (for example, permission to create/drop tables, and select/insert/update/delete in all tables).

Important:

Make sure you have enough disk space for the growth of your PaperCut NG database. A full disk can corrupt the PaperCut NG database. For more information, see Database sizing and growth

We also recommend you set up notifications for low disk space as described here: Alert Email Notification through SCOM 2012 R2.

Step 4: Configure the database

After you have created you database, you must configure it for PaperCut NG. For more information, see:

Step 5: Change the PaperCut NG connection details

The next step is to configure PaperCut NG to connect to the new external database:

  1. On the Application Server, open the server config file in a text editor (e.g. Notepad):

    [app-path]/server/server.properties

  2. Comment out the line:

    database.type=Internal

    by adding a # (hash) character to the beginning of the line.

  3. Find the database connection details for the database type you require (for example, SQL Server or PostgreSQL), and uncomment the lines by removing the # (hash) characters.

  4. Set the username and password to connect to the database:

    database.username=[your-db-user]

    database.password=[your-db-password]

  5. Set the database URL, which describes the location and connection details of the external database.

Step 6: Initialize the new database

The next step is to initialize the new database, creating the required database tables and initial data. To initialize the database:

  1. On the server, open a command prompt. (If you see 'Access Denied' errors, run the command prompt as an Administrator).

  2. On Linux or Mac, use su or equivalent to become the identity of papercut. e.g.

    Mac: sudo su - papercut

    Linux: su - papercut

  3. Change (cd) to the server binaries directory. e.g.

    Windows: cd "C:\Program Files\PaperCut NG\server\bin\win"

    Mac: cd "/Applications/PaperCut NG/server/bin/mac"

    Linux (64-bit): cd ~papercut/server/bin/linux-x64

  4. Run the following command: db-tools init-db.

A message is displayed to indicate that the connection details are correct and the database was initialized correctly.

Step 7: Load the data into the new database

This step loads the data (that was exported in Step 2) into the database. To import the data:

  1. On the server, open a command prompt. (If you see 'Access Denied' errors, run the command prompt as an Administrator).

  2. On Linux or Mac, use su or equivalent to become the identity of papercut. e.g.

    Mac: sudo su - papercut

    Linux: su - papercut

  3. Change (cd) to the server binaries directory. e.g.

    Windows: cd "C:\Program Files\PaperCut NG\server\bin\win"

    Mac: cd "/Applications/PaperCut NG/server/bin/mac"

    Linux (64-bit): cd ~papercut/server/bin/linux-x64

  4. Run the following command: db-tools import-db "backup file name".

    This command shows the data import progress.

If no errors occur, the application is ready to restart.

Step 8: Restart PaperCut NG

The data is now in the new database and you can restart the server.

For more information, see Stop and start the Application Server.

Wait 30 seconds for the server to start, then log in to the Admin web interface. If you can log in successfully, then the upsizing process worked successfully.


Comments

Share your findings and experience with other PaperCut users. Feel free to add comments and suggestions about this Knowledge Base article. Please don't use this for support requests.