wsm12138 commented on issue #19224:
URL:
https://github.com/apache/shardingsphere/issues/19224#issuecomment-1193663788
## server.yaml
```
mode:
type: Cluster
repository:
type: ZooKeeper
props:
namespace: 0725distsql
server-lists: 192.168.10.21:2181
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
overwrite: true
rules:
- !AUTHORITY
users:
- root@%:root
- sharding@:sharding
provider:
type: ALL_PERMITTED
- !SQL_PARSER
sqlCommentParseEnabled: true
sqlStatementCache:
initialCapacity: 2000
maximumSize: 65535
parseTreeCache:
initialCapacity: 128
maximumSize: 1024
props:
proxy-frontend-database-protocol-type: "PostgreSQL"
```
## DistSQL
```
postgres=> create database test;
CREATE DATABASE
postgres=> \c test
psql.bin (10.17, server 12.3-ShardingSphere-Proxy 5.1.3-SNAPSHOT-6fa502a)
WARNING: psql.bin major version 10, server major version 12.
Some psql features might not work.
You are now connected to database "test" as user "root".
test=> ADD RESOURCE resource_0 (
test(> URL="jdbc:postgresql://192.168.10.21:5432/postgres",
test(> USER=gaussdb,
test(> PASSWORD=sphereEx@2021
test(> );
SUCCESS
test=> show database resources;
name | type | host | port | db |
connection_timeout_milliseconds | idle_timeout_milliseconds |
max_lifetime_milliseconds | max_pool_size | min_pool_size | read_only |
other_attributes
------------+------------+---------------+------+----------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+-----------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
resource_0 | PostgreSQL | 192.168.10.21 | 5432 | postgres | 30000
| 60000 | 2100000 | 50
| 1 | false |
{"dataSourceProperties":{},"healthCheckProperties":{},"initializ
ationFailTimeout":1,"validationTimeout":5000,"leakDetectionThreshold":0,"poolName":"HikariPool-2","registerMbeans":false,"allowPoolSuspension":false,"autoCommit":true,"isolateInternalQueries":false}
(1 row)
test=> ADD RESOURCE resource_1 (
test(> URL="jdbc:opengauss://192.168.10.21:5432/postgres",
test(> USER=gaussdb,
test(> PASSWORD=sphereEx@2021
test(> );
ERROR: java.lang.reflect.InvocationTargetException
test=> show database resources;
name | type | host | port | db |
connection_timeout_milliseconds | idle_timeout_milliseconds |
max_lifetime_milliseconds | max_pool_size | min_pool_size | read_only |
other_attributes
------------+-----------+---------------+------+----------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
resource_1 | openGauss | 192.168.10.21 | 5432 | postgres | 30000
| 60000 | 2100000 | 50
| 1 | false |
{"dataSourceProperties":{},"healthCheckProperties":{},"initializa
tionFailTimeout":1,"validationTimeout":5000,"leakDetectionThreshold":0,"poolName":"HikariPool-4","registerMbeans":false,"allowPoolSuspension":false,"autoCommit":true,"isolateInternalQueries":false}
(1 row)
test=> preview select 1;
data_source_name | actual_sql
------------------+------------
resource_1 | select 1
(1 row)
test=> ADD RESOURCE resource_2 (
test(> URL="jdbc:opengauss://192.168.10.21:5432/test",
test(> USER=gaussdb,
test(> PASSWORD=sphereEx@2021
test(> );
ERROR: java.lang.reflect.InvocationTargetException
test=> show database resources;
name | type | host | port | db |
connection_timeout_milliseconds | idle_timeout_milliseconds |
max_lifetime_milliseconds | max_pool_size | min_pool_size | read_only |
other_attributes
------------+-----------+---------------+------+------+---------------------------------+---------------------------+---------------------------+---------------+---------------+-----------+----------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
resource_2 | openGauss | 192.168.10.21 | 5432 | test | 30000
| 60000 | 2100000 | 50
| 1 | false |
{"dataSourceProperties":{},"healthCheckProperties":{},"initialization
FailTimeout":1,"validationTimeout":5000,"leakDetectionThreshold":0,"poolName":"HikariPool-6","registerMbeans":false,"allowPoolSuspension":false,"autoCommit":true,"isolateInternalQueries":false}
(1 row)
test=> preview select 1;
data_source_name | actual_sql
------------------+------------
resource_2 | select 1
(1 row)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]