diff --git a/develop/dev-guide-sample-application-java-mybatis.md b/develop/dev-guide-sample-application-java-mybatis.md index ea97e1250344..f4835e94e8da 100644 --- a/develop/dev-guide-sample-application-java-mybatis.md +++ b/develop/dev-guide-sample-application-java-mybatis.md @@ -77,7 +77,7 @@ cd tidb-java-mybatis-quickstart 6. 复制并粘贴对应连接字符串至 `env.sh` 中。需更改部分示例结果如下: ```shell - export TIDB_HOST='{host}' # e.g. gateway01.ap-northeast-1.prod.aws.tidbcloud.com + export TIDB_HOST='{host}' # e.g. xxxxxx.aws.tidbcloud.com export TIDB_PORT='4000' export TIDB_USER='{user}' # e.g. xxxxxx.root export TIDB_PASSWORD='{password}' @@ -112,9 +112,9 @@ cd tidb-java-mybatis-quickstart 5. 复制并粘贴对应的连接字符串至 `env.sh` 中。需更改部分示例结果如下: ```shell - export TIDB_HOST='{host}' # e.g. tidb.xxxx.clusters.tidb-cloud.com + export TIDB_HOST='{host}' # e.g. xxxxxx.aws.tidbcloud.com export TIDB_PORT='4000' - export TIDB_USER='{user}' # e.g. root + export TIDB_USER='{user}' # e.g. xxxxxx.root export TIDB_PASSWORD='{password}' export TIDB_DB_NAME='test' export USE_SSL='false' @@ -137,9 +137,9 @@ cd tidb-java-mybatis-quickstart 2. 复制并粘贴对应 TiDB 的连接字符串至 `env.sh` 中。需更改部分示例结果如下: ```shell - export TIDB_HOST='{host}' + export TIDB_HOST='{host}' # e.g. xxxxxx.aws.tidbcloud.com export TIDB_PORT='4000' - export TIDB_USER='root' + export TIDB_USER='root' # e.g. xxxxxx.root export TIDB_PASSWORD='{password}' export TIDB_DB_NAME='test' export USE_SSL='false' @@ -193,19 +193,19 @@ cd tidb-java-mybatis-quickstart - - - + + + - + ``` -请将 `${tidb_jdbc_url}`、`${tidb_user}`、`${tidb_password}` 等替换为你的 TiDB 集群的实际值。并替换 `${mapper_location}` 的值为你的 mapper XML 配置文件的位置。如果你有多个 mapper XML 配置文件,需要添加多个 `` 标签。随后编写以下函数: +请将 `${TIDB_JDBC_URL}`、`${TIDB_USER}`、`${TIDB_PASSWORD}` 等替换为你的 TiDB 集群的实际值。并替换 `${MAPPER_LOCATION}` 的值为你的 mapper XML 配置文件的位置。如果你有多个 mapper XML 配置文件,需要添加多个 `` 标签。随后编写以下函数: ```java public SqlSessionFactory getSessionFactory() { @@ -223,8 +223,8 @@ public SqlSessionFactory getSessionFactory() { - insert into player (id, coins, goods) - values (#{id,jdbcType=VARCHAR}, #{coins,jdbcType=INTEGER}, #{goods,jdbcType=INTEGER}) + INSERT INTO player (id, coins, goods) + VALUES (#{id, jdbcType=VARCHAR}, #{coins, jdbcType=INTEGER}, #{goods, jdbcType=INTEGER}) ``` @@ -248,9 +248,9 @@ public SqlSessionFactory getSessionFactory() { ``` @@ -266,10 +266,10 @@ public SqlSessionFactory getSessionFactory() { - update player - set coins = #{coins,jdbcType=INTEGER}, - goods = #{goods,jdbcType=INTEGER} - where id = #{id,jdbcType=VARCHAR} + UPDATE player + SET coins = #{coins, jdbcType=INTEGER}, + goods = #{goods, jdbcType=INTEGER} + WHERE id = #{id, jdbcType=VARCHAR} ``` @@ -285,8 +285,8 @@ public SqlSessionFactory getSessionFactory() { - delete from player - where id = #{id,jdbcType=VARCHAR} + DELETE FROM player + WHERE id = #{id, jdbcType=VARCHAR} ```