Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add document of data source for proxy #28475

Merged
merged 6 commits into from
Sep 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 <data-source-name> available
<data_source_name>: # 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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
+++
title = "数据源配置"
weight = 4
chapter = true
+++

## 背景信息

ShardingSphere-Proxy 支持常见的数据库连接池: HikariCP、C3P0、DBCP。

可以通过参数 `dataSourceClassName` 指定连接池,当不指定时,默认的的数据库连接池为 HikariCP。

## 参数解释

```yaml
dataSources: # 数据源配置,可配置多个 <data-source-name>
<data_source_name>: # 数据源名称
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:

# 配置其他数据源
```
Original file line number Diff line number Diff line change
@@ -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 <data-source-name> available
<data_source_name>: # 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
```