strongduanmu commented on a change in pull request #13874:
URL: https://github.com/apache/shardingsphere/pull/13874#discussion_r760678982



##########
File path: 
docs/document/content/user-manual/shardingsphere-jdbc/special-api/sharding/hint.cn.md
##########
@@ -125,3 +127,46 @@ try (HintManager hintManager = HintManager.getInstance();
     }
 }
 ```
+
+### 使用 Hint 路由至任意指定数据库
+
+#### 使用手动编程的方式
+
+##### 获取 HintManager
+
+与基于 Hint 的数据分片相同。
+
+##### 设置路由至任意指定数据库
+
+- 使用 `hintManager.setDataSourceName` 设置数据库名称。
+
+##### 完整代码示例
+
+```java
+String sql = "SELECT * FROM t_order";
+try (HintManager hintManager = HintManager.getInstance();
+     Connection conn = dataSource.getConnection();
+     PreparedStatement preparedStatement = conn.prepareStatement(sql)) {
+    hintManager.setDataSourceName("ds_0");
+    try (ResultSet rs = preparedStatement.executeQuery()) {
+        while (rs.next()) {
+            // ...
+        }
+    }
+}
+```
+
+#### 使用 SQL 注释的方式
+
+##### 使用规范
+- 需要开启解析注释的配置

Review comment:
       @tuichenchuxin Can we add the configuration that needs to be turned on 
here?

##########
File path: 
docs/document/content/user-manual/shardingsphere-jdbc/special-api/sharding/hint.cn.md
##########
@@ -125,3 +127,46 @@ try (HintManager hintManager = HintManager.getInstance();
     }
 }
 ```
+
+### 使用 Hint 路由至任意指定数据库

Review comment:
       @tuichenchuxin `使用 Hint 路由至指定数据库` is better.




-- 
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]


Reply via email to