Database-related Problems

Database Connectivity Errors

The most common problems encountered with a new JasperReports Server instance are database configuration problems. If the connection fails, perhaps the application server cannot find the driver for the data source. For example, in a default installation of JasperReports Server, Tomcat looks for data source drivers in <js‑install>/apache-tomcat/lib. If the driver is not there, put a copy of the driver in this directory and restart Tomcat.

This section contains information that may help resolve other connectivity issues.

Testing the Database Connection

The simplest database configuration problem is an incorrect user name or password. If you encounter database problems upon startup or login, check the user name and password by logging directly into your RDBMS as described in the following sections.

You can connect to your database using the database configuration settings that are found in JasperReports Server. This validates the database hostname, port, username, and password that are being used.

If you are having trouble logging into JasperReports Server on the login page, you can check the users and passwords that exist by viewing the contents of the jasperserver.JIUser table.

Logging into PostgreSQL

Run the PostgreSQL client from the command line and try to connect to the database. For example:

psql -U postgres jasperserver

Logging into MySQL

Run the MySQL client from the command line and try to log in directly using the root user, for example:

<mysql>/bin/mysql -u root -p

You are prompted for a password for the user you specified on the command line. Enter the appropriate password to login. The default password used in the sample configuration scripts is password (jasperadmin in 2.1 and earlier).

Maximum Packet Size in MySQL

If you are upgrading or importing into a MySQL database and your repository contains large objects such as images, you may see an error such as:

ERROR 1153 (08S01): Got a packet bigger than 'max_allowed_packet' bytes

The default max_allowed_packet on the MySQL server is 1M (one Megabyte = 1,048,576 bytes). The most effective fix is to change this value in the server configuration to accommodate the largest resource stored in your repository. The server configuration file is typically named my.cnf (or my.ini) and is located in the MySQL root directory, although this may vary. Change the configuration setting to a larger value, for example:

max_allowed_packet = 16M

For more information, see http://dev.mysql.com/doc/refman/5.0/en/packet-too-large.html.

After changing this value, restart the MySQL server. Then perform the upgrade or import step again.

Connection reset by peer MySQL Error

If you are using the MariaDB JDBC driver in order to connect to the MySQL database, and you get an error similar to the following: 

Could not send query:

Connection reset by peer: socket write error

This is the maximum packet size error seen in the previous section, with a different error message. Follow the instructions in the section above.

Case Sensitivity for Table and Column Names

Some databases are case-sensitive with respect to table names and will consider “customer” and “Customer” to be two different tables. If JasperReports Server is using a case-sensitive database, it’s important that the table names specified in query strings in the JRXML file of a saved report match the actual table names found in the database. A mismatch may occur if you are transferring data from one database to another, which may cause the capitalization of table names to change.

Under Windows MySQL, table and column names are not case-sensitive.

Under Linux MySQL, table and column names are case-sensitive. Linux MySQL can be configured to be non-case-sensitive by setting the configuration parameter lower_case_table_names to 1 in the my.ini or my.cnf file. For more information search the MySQL documentation for a section about identifier case sensitivity.

Table and column names in PostgreSQL are case-sensitive.

PostgreSQL: Job Scheduling Error

If the Quartz settings under the PostgreSQL database have not been updated to specify the driver delegate class specific to PostgreSQL you will get errors when you try and run a scheduled report. The errors would look similar to the following:

Error while fetching Quartz runtime information
org.quartz.JobPersistenceException: Couldn't obtain triggers: Bad value for type int
org.postgresql.util.PSQLException: Bad value for type int

If you see this error you will need to check your Quartz properties file found at the following location:

<tomcat>/webapps/jasperserver-ce/WEB-INF/js.quartz.properties

Make sure that the following property does not have the standard driver delegate, but instead has the PostgreSQL specific driver delegate. It should look like the following for PostgreSQL:

quartz.delegateClass=org.quartz.impl.jdbcjobstore.PostgreSQLDelegate

Error Running Scheduled Report

If you setup a scheduled report, chose to run it, and chose to save it as HTML or RTF, the report size can potentially get quite large. If you are running MySQL and you get the following error:

JDBC exception on Hibernate data access

org.hibernate.exception.GenericJDBCException: could not insert

the problem may be the default size of the MySQL blob datatype. You can increase the size of this datatype by updating your my.ini or my.cnf MySQL configuration file with the following setting:

max_allowed_packet=32M

Error Running a Report

If you can log into JasperReports Server but encounter an error when running a report within it, you can browse the repository to identify and resolve the problem.

One common problem with an individual report is the data source being used. To validate a data source connection:

1. Log into JasperReports Server as a user with administrative permissions and locate the report unit that returns errors.
2. Select the report and click the Edit button in the toolbar to identify the data source the report uses. The data source name is found on the fourth edit page.
3. Select this data source in the repository and click the Edit button in the toolbar.
4. Review the information specified for this data source.
5. Click the Test Connection button in order to validate the connection.

If the connection fails, perhaps the application server cannot find the driver for the data source. For example, in a default installation of JasperReports Server, Tomcat looks for data source drivers in <js‑install>/apache-tomcat/lib.

6. Click Save or Cancel when you are done.
7. Test your report. If it still returns errors, edit the data source again and try checking other values, such as the port used by the database.
Version: 
Feedback
randomness