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.,
A detailed description of the Blueriq properties file can be found on the Reference Guide: Properties [editor].
A description of the usage of Spring profiles in Blueriq can be found here.
Hibernate Dialects
For Oracle use as the oracle.jdbc.driver.OracleDriver
and org.hibernate.dialect.Oracle10gDialect
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= |
Configure the properties below in application-externaldatasources.properties which is on the classpath.
...
blueriq.datasource.comments-sql-store.url
jdbc:sqlserver:// |
...
demo- |
...
host:1433;databaseName= |
...
db_ |
...
main;instance=SQL_EXPRESS blueriq.datasource.[datasource_name].username=username blueriq.datasource.[datasource_name].password=password blueriq.datasource.[datasource_name].driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver blueriq.datasource.[datasource_name].jndiName= blueriq.datasource.[datasource_name].type=org.apache.commons.dbcp2.BasicDataSource |
...
The datasource.[datasource
...
blueriq.datasource.comments-sql-store.password
...
_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 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.main.url=jdbc:sqlserver://<database_url>:1433;databaseName=bq_main;instance=SQL_EXPRESS
blueriq.datasource.main.username=<username>
blueriq.datasource.main.password=<password>
blueriq.datasource.main.driverClassName= |
...
blueriq.datasource.comments-sql-store.driverClassName
com.microsoft.sqlserver.jdbc.SQLServerDriver |
...
blueriq.hibernate. |
...
main.hbm2ddl.auto |
...
= blueriq.hibernate. |
...
main.dialect |
...
=org.hibernate.dialect.SQLServerDialect |
...
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= blueriq.hibernate.trace.dialect=org.hibernate.dialect.SQLServerDialect 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 |
...
= blueriq.hibernate. |
...
reporting.dialect |
...
=org.hibernate.dialect.SQLServerDialect |
...
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.main.jndiName=java:/comp/env/jdbc/main
blueriq.hibernate.main.hbm2ddl.auto=create
blueriq.datasource.trace.jndiName=java:/comp/env/jdbc/trace
blueriq.hibernate.trace.hbm2ddl.auto=create
blueriq.datasource.reporting.jndiName=java:/comp/env/jdbc/reporting
blueriq.hibernate.reporting.hbm2ddl.auto=create
spring.jmx.enabled=false
endpoints.jmx.unique-names=true |