3.1. persistence.properties

ReportServer uses the Java Persistence API (JPA) to abstract from the actual database system when storing application data. The necessary configuration is made in the persistence.properties config file.

Example

	hibernate.dialect=net.datenwerke.rs.utils.hibernate.MySQL5Dialect
	hibernate.connection.driver_class=com.mysql.cj.jdbc.Driver
	hibernate.connection.url=jdbc:mysql://localhost:3306/reportserver
	hibernate.connection.username=rs
	hibernate.connection.password=rs
Note that to configure the JPA/Hibernate settings, we are not editing the standard JPA configuration file (usually called persistence.xml) but a ReportServer properties file.
3.1.1. Connection properties

ReportServer supports all databases, that are supported by Hibernate. A list of the database systems supported by Hibernate can be found on the hibernate webpages . We recommend to run ReportServer on one of the following databases for which we now give example configurations:

Example config for MySQL
	# MySQL 
	hibernate.dialect=net.datenwerke.rs.utils.hibernate.MySQL5Dialect
	hibernate.connection.driver_class=com.mysql.cj.jdbc.Driver
	hibernate.connection.url=jdbc:mysql://localhost:3306/reportserver
	hibernate.connection.username=rs
	hibernate.connection.password=rs
Note the custom dialect net.datenwerke.rs.utils.hibernate.MySQL5Dialect.
Example config for PostgreSQL
	# PostgreSQL
	hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
	hibernate.connection.driver_class=org.postgresql.Driver
	hibernate.connection.url=jdbc:postgresql://localhost/postgres
	hibernate.connection.username=rs
	hibernate.connection.password=rs
	hibernate.connection.autocommit=false
Example config for Oracle
	# Oracle
	#
	# Select ONE of the following dialects depending on your Oracle version
	#
	hibernate.dialect=net.datenwerke.rs.utils.hibernate.Oracle10gDialect
	# 	hibernate.dialect=net.datenwerke.rs.utils.hibernate.Oracle12cDialect
	#
	hibernate.connection.driver_class=oracle.jdbc.driver.OracleDriver
	hibernate.connection.url=jdbc:oracle:thin:@localhost:1521:MYDB
	hibernate.connection.username=rs
	hibernate.connection.password=rs
	hibernate.connection.autocommit=false
Example config for SQL Server
	# SQL Server
	hibernate.dialect=org.hibernate.dialect.SQLServer2008Dialect
	hibernate.connection.driver_class=com.microsoft.sqlserver.jdbc.SQLServerDriver
	hibernate.connection.url=jdbc:sqlserver://localhost/sqlserver:1433;databaseName=mydb
	hibernate.connection.username=rs
	hibernate.connection.password=rs
	hibernate.connection.autocommit=false

Note, that the JDBC driver corresponding to your database must be copied to the directory

path_to_webapps/reportserver/WEB-INF/lib or to your external-configuration directory.

3.1.2. Connection Pool (C3P0) Settings

Hibernate uses the C3P0 connection pool. The following properties allow to configure C3P0 as used by Hibernate. Note that this does not have any effect on the connection pool used by ReportServer for handling reporting.

  	hibernate.c3p0.acquire_increment=5
	hibernate.c3p0.idle_test_period=60
	hibernate.c3p0.timeout=3600
	hibernate.c3p0.max_size=30
	hibernate.c3p0.max_statements=0
	hibernate.c3p0.min_size=5

See also http://www.mchange.com/projects/c3p0/index.html#configuration.

The most commonly used properties are:

Property Description
acquire_increment Defines how many connections are acquired simultaniously by c3p0, if all connections currently in the pool are busy.
idle_test_period If not zero, C3P0 will test idle connections in this intervall.
timeout Number of seconds a pooled connection can remain idle before it is discarded. Zero means that idle connections are never discarded.
max_size Maximum number of connections in the pool.
max_statements Maximal size of the statement cache. Zero means that statements should not be cached.
min_size The minimum number of connections to be kept in the pool.