diff --git a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/data-source.en.md b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/data-source.en.md index d5bf857296fd5..e8595212d21f3 100644 --- a/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/data-source.en.md +++ b/docs/document/content/user-manual/shardingsphere-jdbc/yaml-config/data-source.en.md @@ -6,7 +6,7 @@ chapter = true ## Background -ShardingSphere-JDBC Supports all JDBC drivers and database connection pools. +ShardingSphere-JDBC Supports all JDBC drivers and data source connection pools. In this example, the database driver is MySQL, and the connection pool is HikariCP, which can be replaced with other database drivers and connection pools. When using ShardingSphere JDBC, the property name of the JDBC pool depends on the definition of the respective JDBC pool and is not defined by ShardingSphere. For related processing, please refer to the class org.apache.shardingsphere.infra.datasource.pool.creator.DataSourcePoolCreator. @@ -18,10 +18,10 @@ For example, with Alibaba Druid 1.2.9, using url instead of jdbcUrl in the examp dataSources: # Data sources configuration, multiple available : # Data source name dataSourceClassName: # Data source class name - driverClassName: # The database driver class name is subject to the configuration of the database connection pool itself - jdbcUrl: # The database URL connection is subject to the configuration of the database connection pool itself - username: # Database user name, subject to the configuration of the database connection pool itself - password: # The database password is subject to the configuration of the database connection pool itself + driverClassName: # The database driver class name is subject to the configuration of the data source connection pool itself + jdbcUrl: # The database URL connection is subject to the configuration of the data source connection pool itself + username: # Database username, subject to the configuration of the data source connection pool itself + password: # The database password is subject to the configuration of the data source connection pool itself # ... Other properties of data source pool ``` ## Sample diff --git a/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/data-source.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/data-source.cn.md new file mode 100644 index 0000000000000..51cc806077fbe --- /dev/null +++ b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/data-source.cn.md @@ -0,0 +1,44 @@ ++++ +title = "数据源配置" +weight = 4 +chapter = true ++++ + +## 背景信息 + +ShardingSphere-Proxy 支持常见的数据库连接池: HikariCP、C3P0、DBCP。 + +可以通过参数 `dataSourceClassName` 指定连接池,当不指定时,默认的的数据库连接池为 HikariCP。 + +## 参数解释 + +```yaml +dataSources: # 数据源配置,可配置多个 + : # 数据源名称 + dataSourceClassName: # 数据源连接池完整类名 + url: # 数据库 URL 连接 + username: # 数据库用户名 + password: # 数据库密码 + # ... 数据库连接池的其它属性 +``` +## 配置示例 + +```yaml +dataSources: + ds_1: + url: jdbc:mysql://localhost:3306/ds_1 + username: root + password: + ds_2: + dataSourceClassName: com.mchange.v2.c3p0.ComboPooledDataSource + url: jdbc:mysql://localhost:3306/ds_2 + username: root + password: + ds_3: + dataSourceClassName: org.apache.commons.dbcp2.BasicDataSource + url: jdbc:mysql://localhost:3306/ds_3 + username: root + password: + + # 配置其他数据源 +``` diff --git a/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/data-source.en.md b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/data-source.en.md new file mode 100644 index 0000000000000..0f44b8507578b --- /dev/null +++ b/docs/document/content/user-manual/shardingsphere-proxy/yaml-config/data-source.en.md @@ -0,0 +1,44 @@ ++++ +title = "Data Source" +weight = 4 +chapter = true ++++ + +## Background + +ShardingSphere-Proxy supports common data source connection pools: HikariCP, C3P0, DBCP. + +The connection pool can be specified through the parameter `dataSourceClassName`. When not specified, the default data source connection pool is HikariCP. + +## Parameters + +```yaml +dataSources: # Data sources configuration, multiple available + : # Data source name + dataSourceClassName: # Data source connection pool full class name + url: # The database URL connection + username: # Database username + password: # The database password + # ... Other properties of data source pool +``` +## Sample + +```yaml +dataSources: + ds_1: + url: jdbc:mysql://localhost:3306/ds_1 + username: root + password: + ds_2: + dataSourceClassName: com.mchange.v2.c3p0.ComboPooledDataSource + url: jdbc:mysql://localhost:3306/ds_2 + username: root + password: + ds_3: + dataSourceClassName: org.apache.commons.dbcp2.BasicDataSource + url: jdbc:mysql://localhost:3306/ds_3 + username: root + password: + + # Configure other data sources +```