Page History
Datasources can be configured in the application-externaldatasources.properties
or in the application-jndidatasources.properties
file. When configuring external datasources , the externaldatasources
profile should be enabled. When configuring JNDI datasources the jndidatasources
profile should be enabled.,
...
datasource.main.url
Note |
---|
It is possible to enable both profiles but make sure a datasource is configured in just one of the .properties file. |
A detailed description of the Blueriq properties file can be found on the Reference Guide: Properties.
A description of the usage of Spring profiles in Blueriq can be found here.
Hibernate Dialects: Oracle database, Microsoft (MS) SQL Server database
For Oracle use as the oracle.jdbc.driver.OracleDriver
and org.hibernate.dialect.Oracle12cDialect
as the dialect.
For Microsoft SQL Server use com.microsoft.sqlserver.jdbc.SQLServerDriver
as the driverClassName and org.hibernate.dialect.SQLServer2012Dialect
as the dialect.
External datasources
The following configuration options are available for external datasources
Code Block | ||
---|---|---|
| ||
blueriq.datasource.[datasource_name].url=jdbc:sqlserver:// |
...
demo- |
...
host:1433;databaseName= |
...
db_main;instance=SQL_EXPRESS |
...
blueriq.datasource. |
...
datasource.main.password
...
datasource.main.driverClassName
[datasource_name].username=username blueriq.datasource.[datasource_name].password=password blueriq.datasource.[datasource_name].driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver blueriq.datasource.[datasource_name].type=org.apache.commons.dbcp2.BasicDataSource |
...
hibernate.main.hbm2ddl.auto
...
hibernate.main.dialect
...
org.hibernate.dialect.SQLServerDialect
...
datasource.trace.url
The datasource.[datasource_name].type
property configures the custom DataSource implementation used (needs to implement the javax.sql.DataSource interface). If not set or can't be loaded the default one, org.apache.commons.dbcp.BasicDataSource (from dbcp2) will be used.
For the driverClassName
property, see Configuring JDBC database drivers for possible values.
For dbcp2 datasources the following additional options are available:
Code Block | ||
---|---|---|
| ||
blueriq.datasource.[datasource_name].poolInitialSize=0
blueriq.datasource.[datasource_name].poolMaxTotal=8
blueriq.datasource.[datasource_name].poolMaxIdle=8
blueriq.datasource.[datasource_name].poolMinIdle=0
blueriq.datasource.[datasource_name].poolMaxWait=-1L
blueriq.datasource.[datasource_name].validationQuery=""
blueriq.datasource.[datasource_name].validationQueryTimeout=-1
blueriq.datasource.[datasource_name].testOnBorrow=true
blueriq.datasource.[datasource_name].testOnReturn=false
blueriq.datasource.[datasource_name].testWhileIdle=false
blueriq.datasource.[datasource_name].timeBetweenEvictionRunsMillis=-1
blueriq.datasource.[datasource_name].numTestsPerEvictionRun=3
blueriq.datasource.[datasource_name].minEvictableIdleTimeMillis=1800000 |
An example configuration when using the externaldatasources
profile:
Code Block | ||
---|---|---|
| ||
blueriq.datasource.trace.url=jdbc:sqlserver://<database_url> |
...
;databaseName=bq_trace;instance=SQL_EXPRESS |
...
blueriq.datasource.trace.username |
...
=<username> blueriq.datasource.trace.password |
...
=<password> blueriq.datasource.trace.driverClassName |
...
=com.microsoft.sqlserver.jdbc.SQLServerDriver |
...
blueriq.hibernate.trace.hbm2ddl.auto=validate blueriq.hibernate.trace.dialect=org.hibernate.dialect.SQLServer2012Dialect blueriq.datasource.reporting.url |
...
=jdbc:sqlserver:// |
...
<database_url>:1433;databaseName=bq_reporting;instance=SQL_EXPRESS |
...
blueriq.datasource.reporting.username= |
...
<username> blueriq.datasource.reporting.password |
...
=<password> blueriq.datasource.reporting.driverClassName |
...
=com.microsoft.sqlserver.jdbc.SQLServerDriver |
...
blueriq.hibernate.reporting.hbm2ddl.auto |
...
=validate blueriq.hibernate.reporting.dialect |
...
=org.hibernate.dialect |
...
.SQLServer2012Dialect |
Info |
---|
While in earlier versions the datasources were sometimes shared between components, now each component has its own datasource. For an overview of components and plugins, see Installation. |
JNDI datasources
When using the jndidatasources
profile, the jndiName
property should be set, the url
, username
, password and driverClassName
aren't needed.
An example configuration file:
Code Block | ||
---|---|---|
| ||
blueriq.datasource.trace.jndiName=java:/comp/env/jdbc/trace
blueriq.hibernate.trace.hbm2ddl.auto=validate
blueriq.datasource.reporting.jndiName=java:/comp/env/jdbc/reporting
blueriq.hibernate.reporting.hbm2ddl.auto=validate
spring.jmx.enabled=false
endpoints.jmx.unique-names=true |