This is a configuration file for a Spring Boot application. It sets up two data sources, one for PostgreSQL and one for Oracle.

For the PostgreSQL data source:

  • The JDBC URL specifies the host, port, database name, and additional connection parameters: 'jdbc:postgresql://192.168.0.186:5432/postgis_szjg?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai'.
  • The driver class name is set to 'org.postgresql.Driver'.
  • The username and password for the database are provided.
  • The connection pool implementation is set to 'com.zaxxer.hikari.HikariDataSource'.
  • Various connection pool settings are configured, such as initial size, minimum idle connections, maximum active connections, and maximum wait time.
  • A validation query is specified to test the connection: 'select version()'.
  • Additional settings related to connection eviction and testing are also provided.
  • The Hibernate dialect for PostgreSQL is set to 'org.hibernate.dialect.PostgreSQLDialect'.

For the Oracle data source:

  • The JDBC URL specifies the host, port, and service name for the Oracle database: 'jdbc:oracle:thin:@192.168.0.231:1521:ORCL'.
  • The driver class name is set to 'oracle.jdbc.driver.OracleDriver'.
  • The username and password for the database are provided.
  • The connection pool implementation is set to 'com.zaxxer.hikari.HikariDataSource'.
  • The Hibernate dialect for Oracle is set to 'org.hibernate.dialect.OracleDialect'.

Note that the same property 'spring.jpa.properties.hibernate.dialect' is used for both data sources, but it will only take effect for the last data source defined.

Spring Boot Datasource Configuration: PostgreSQL and Oracle

原文地址: https://www.cveoy.top/t/topic/p9k5 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录