<h2 dir="auto">Bug Report<strong>For English only</strong>, other languages will not accept.</h2>
<p dir="auto">Before report a bug, make sure you have:</p>
<ul dir="auto">
<li>Searched open and closed <a href="https://github.com/apache/shardingsphere/issues">GitHub issues</a>.</li>
<li>Read documentation: <a href="https://shardingsphere.apache.org/document/current/en/overview" rel="nofollow">ShardingSphere Doc</a>.</li>
</ul>
<p dir="auto">Please pay attention on issues you submitted, because we maybe need more details.<br>
If no response anymore and we cannot reproduce it on current information, we will <strong>close it</strong>.</p>
<p dir="auto">Please answer these questions before submitting your issue. Thanks!</p>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">5.0.0-RC1-SNAPSHOT</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">ShardingSphere-JDBC</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">i got some error when use 5.0.0-RC1-SNAPSHOT although it's work well in  5.0.0-beta</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">SQL: select count(<em>) from (select car,count(</em>) as cnt from table group by car) a<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/35786966/126596688-9a1d784d-22c2-4263-82ab-714fb2d5542d.png"><img src="https://user-images.githubusercontent.com/35786966/126596688-9a1d784d-22c2-4263-82ab-714fb2d5542d.png" alt="image" style="max-width: 100%;"></a></p>
<h3 dir="auto">Reason analyze (If you can)### Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<h2 dir="auto">Bug Report</h2>
<h3 dir="auto">Which version of ShardingSphere did you use?</h3>
<p dir="auto">5.1.1</p>
<h3 dir="auto">Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?</h3>
<p dir="auto">ShardingSphere-Proxy</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">execute prepareStatement like <code class="notranslate">INSERT INTO remark (userid, content, </code>time<code class="notranslate">) VALUES (?, ?, ?) </code></p>
<h3 dir="auto">Actual behavior</h3>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken@' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.Util.getInstance(Util.java:408)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1242)
	at com.wingkingbobo.splitdb.service.RemarkServiceImpl.testInsert(RemarkServiceImpl.java:107)"><pre class="notranslate"><code class="notranslate">com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'org.apache.shardingsphere.sharding.rewrite.token.pojo.ShardingInsertValuesToken@' at line 1
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at com.mysql.jdbc.Util.handleNewInstance(Util.java:425)
	at com.mysql.jdbc.Util.getInstance(Util.java:408)
	at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:944)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3978)
	at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3914)
	at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2530)
	at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2683)
	at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2495)
	at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1903)
	at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1242)
	at com.wingkingbobo.splitdb.service.RemarkServiceImpl.testInsert(RemarkServiceImpl.java:107)
</code></pre></div>
<h3 dir="auto">Reason analyze (If you can)</h3>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<ul dir="auto">
<li>steps
<ul dir="auto">
<li>create database <code class="notranslate">p</code>, <code class="notranslate">p1</code> by create table statement.</li>
<li>run demo
<ul dir="auto">
<li><code class="notranslate">jdbcUrl=JDBC_URL_MYSQL</code>: OK</li>
<li><code class="notranslate">jdbcUrl=JDBC_URL_MYSQL</code>: throw <code class="notranslate">MySQLSyntaxErrorException</code></li>
</ul>
</li>
</ul>
</li>
<li>demo</li>
</ul>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="
    private static final String JDBC_URL_MYSQL = &quot;jdbc:mysql://localhost:3306/p1?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai&quot;;
    private static final String JDBC_URL_SHARDING_PROXY = &quot;jdbc:mysql://localhost:3307/sharding_db?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai&quot;;

    public static void main(String[] args) {
        String jdbcUrl = JDBC_URL_SHARDING_PROXY;
        try {
            testInsert(createRemarkList(1).get(0), jdbcUrl);
            // testBatchInsert(createRemarkList(1).get(0), jdbcUrl);
        } catch(Exception e) {
            e.printStacktrace();
        }
        
    }

    private List&lt;RemarkPO&gt; createRemarkList(int count) {
        List&lt;RemarkPO&gt; remarks = new ArrayList&lt;&gt;();

        for (int i = 0; i &lt; count; i++) {
            RemarkPO remark = new RemarkPO();
            remark.setUserId(4);
            remark.setContent(&quot;test&quot;+i);
            remark.setTime(new Date());
            remarks.add(remark);
        }

        return remarks;
    }

    private boolean testInsert(RemarkPO remark, String jdbcUrl) throws Exception{
        DriverManager.registerDriver(new Driver());
        Connection connection = DriverManager.getConnection(jdbcUrl, &quot;root&quot;, &quot;123456&quot;);

        String sql = &quot;INSERT INTO remark(userid, content, `time`) VALUES (?, ?, ?)&quot;;
        PreparedStatement statement = connection.prepareStatement(sql);
        statement.setLong(1, remark.getUserId());
        statement.setString(2, remark.getContent());
        statement.setDate(3, toSqlDate(remark.getTime()));
        statement.execute();
        return true;
    }

    private boolean testBatchInsert(List&lt;RemarkPO&gt; remarks, String jdbcUrl) throws Exception {
        if (remarks.isEmpty()) {
            return false;
        }
        DriverManager.registerDriver(new Driver());
        Connection connection = DriverManager.getConnection(jdbcUrl, &quot;root&quot;, &quot;123456&quot;);

        StringBuilder sb = new StringBuilder(&quot;INSERT INTO remark(userid, content, `time`) VALUES &quot;);
        for (int i = 0; i &lt; remarks.size(); i++) {
            if (i != 0) {
                sb.append(&quot;,&quot;);
            }
            sb.append(&quot; (?, ?, ?)&quot;);
        }
        String sql = sb.toString();
        PreparedStatement statement = connection.prepareStatement(sql);
        int stride = 3;
        for (int i = 0; i &lt; remarks.size(); i++) {
            int offset = stride * i;
            RemarkPO remark = remarks.get(i);
            statement.setLong(1 + offset, remark.getUserId());
            statement.setString(2 + offset, remark.getContent());
            statement.setDate(3 + offset, toSqlDate(remark.getTime()));
        }

        statement.execute();

        return true;
    }

    private java.sql.Date toSqlDate(Date date) {
        return new java.sql.Date(date.getTime());
    }"><pre class="notranslate">    <span class="pl-k">private</span> <span class="pl-k">static</span> <span class="pl-k">final</span> <span class="pl-smi">String</span> <span class="pl-c1">JDBC_URL_MYSQL</span> = <span class="pl-s">"jdbc:mysql://localhost:3306/p1?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai"</span>;
    <span class="pl-k">private</span> <span class="pl-k">static</span> <span class="pl-k">final</span> <span class="pl-smi">String</span> <span class="pl-c1">JDBC_URL_SHARDING_PROXY</span> = <span class="pl-s">"jdbc:mysql://localhost:3307/sharding_db?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai"</span>;

    <span class="pl-k">public</span> <span class="pl-k">static</span> <span class="pl-smi">void</span> <span class="pl-s1">main</span>(<span class="pl-smi">String</span>[] <span class="pl-s1">args</span>) {
        <span class="pl-smi">String</span> <span class="pl-s1">jdbcUrl</span> = <span class="pl-c1">JDBC_URL_SHARDING_PROXY</span>;
        <span class="pl-k">try</span> {
            <span class="pl-en">testInsert</span>(<span class="pl-en">createRemarkList</span>(<span class="pl-c1">1</span>).<span class="pl-en">get</span>(<span class="pl-c1">0</span>), <span class="pl-s1">jdbcUrl</span>);
            <span class="pl-c">// testBatchInsert(createRemarkList(1).get(0), jdbcUrl);</span>
        } <span class="pl-k">catch</span>(<span class="pl-smi">Exception</span> <span class="pl-s1">e</span>) {
            <span class="pl-s1">e</span>.<span class="pl-en">printStacktrace</span>();
        }
        
    }

    <span class="pl-k">private</span> <span class="pl-smi">List</span>&lt;<span class="pl-smi">RemarkPO</span>&gt; <span class="pl-s1">createRemarkList</span>(<span class="pl-smi">int</span> <span class="pl-s1">count</span>) {
        <span class="pl-smi">List</span>&lt;<span class="pl-smi">RemarkPO</span>&gt; <span class="pl-s1">remarks</span> = <span class="pl-k">new</span> <span class="pl-smi">ArrayList</span>&lt;&gt;();

        <span class="pl-k">for</span> (<span class="pl-smi">int</span> <span class="pl-s1">i</span> = <span class="pl-c1">0</span>; <span class="pl-s1">i</span> &lt; <span class="pl-s1">count</span>; <span class="pl-s1">i</span>++) {
            <span class="pl-smi">RemarkPO</span> <span class="pl-s1">remark</span> = <span class="pl-k">new</span> <span class="pl-smi">RemarkPO</span>();
            <span class="pl-s1">remark</span>.<span class="pl-en">setUserId</span>(<span class="pl-c1">4</span>);
            <span class="pl-s1">remark</span>.<span class="pl-en">setContent</span>(<span class="pl-s">"test"</span>+<span class="pl-s1">i</span>);
            <span class="pl-s1">remark</span>.<span class="pl-en">setTime</span>(<span class="pl-k">new</span> <span class="pl-smi">Date</span>());
            <span class="pl-s1">remarks</span>.<span class="pl-en">add</span>(<span class="pl-s1">remark</span>);
        }

        <span class="pl-k">return</span> <span class="pl-s1">remarks</span>;
    }

    <span class="pl-k">private</span> <span class="pl-smi">boolean</span> <span class="pl-s1">testInsert</span>(<span class="pl-smi">RemarkPO</span> <span class="pl-s1">remark</span>, <span class="pl-smi">String</span> <span class="pl-s1">jdbcUrl</span>) <span class="pl-k">throws</span> <span class="pl-s1">Exception</span>{
        <span class="pl-smi">DriverManager</span>.<span class="pl-en">registerDriver</span>(<span class="pl-k">new</span> <span class="pl-smi">Driver</span>());
        <span class="pl-smi">Connection</span> <span class="pl-s1">connection</span> = <span class="pl-smi">DriverManager</span>.<span class="pl-en">getConnection</span>(<span class="pl-s1">jdbcUrl</span>, <span class="pl-s">"root"</span>, <span class="pl-s">"123456"</span>);

        <span class="pl-smi">String</span> <span class="pl-s1">sql</span> = <span class="pl-s">"INSERT INTO remark(userid, content, `time`) VALUES (?, ?, ?)"</span>;
        <span class="pl-smi">PreparedStatement</span> <span class="pl-s1">statement</span> = <span class="pl-s1">connection</span>.<span class="pl-en">prepareStatement</span>(<span class="pl-s1">sql</span>);
        <span class="pl-s1">statement</span>.<span class="pl-en">setLong</span>(<span class="pl-c1">1</span>, <span class="pl-s1">remark</span>.<span class="pl-en">getUserId</span>());
        <span class="pl-s1">statement</span>.<span class="pl-en">setString</span>(<span class="pl-c1">2</span>, <span class="pl-s1">remark</span>.<span class="pl-en">getContent</span>());
        <span class="pl-s1">statement</span>.<span class="pl-en">setDate</span>(<span class="pl-c1">3</span>, <span class="pl-en">toSqlDate</span>(<span class="pl-s1">remark</span>.<span class="pl-en">getTime</span>()));
        <span class="pl-s1">statement</span>.<span class="pl-en">execute</span>();
        <span class="pl-k">return</span> <span class="pl-c1">true</span>;
    }

    <span class="pl-k">private</span> <span class="pl-smi">boolean</span> <span class="pl-s1">testBatchInsert</span>(<span class="pl-smi">List</span>&lt;<span class="pl-smi">RemarkPO</span>&gt; <span class="pl-s1">remarks</span>, <span class="pl-smi">String</span> <span class="pl-s1">jdbcUrl</span>) <span class="pl-k">throws</span> <span class="pl-s1">Exception</span> {
        <span class="pl-k">if</span> (<span class="pl-s1">remarks</span>.<span class="pl-en">isEmpty</span>()) {
            <span class="pl-k">return</span> <span class="pl-c1">false</span>;
        }
        <span class="pl-smi">DriverManager</span>.<span class="pl-en">registerDriver</span>(<span class="pl-k">new</span> <span class="pl-smi">Driver</span>());
        <span class="pl-smi">Connection</span> <span class="pl-s1">connection</span> = <span class="pl-smi">DriverManager</span>.<span class="pl-en">getConnection</span>(<span class="pl-s1">jdbcUrl</span>, <span class="pl-s">"root"</span>, <span class="pl-s">"123456"</span>);

        <span class="pl-smi">StringBuilder</span> <span class="pl-s1">sb</span> = <span class="pl-k">new</span> <span class="pl-smi">StringBuilder</span>(<span class="pl-s">"INSERT INTO remark(userid, content, `time`) VALUES "</span>);
        <span class="pl-k">for</span> (<span class="pl-smi">int</span> <span class="pl-s1">i</span> = <span class="pl-c1">0</span>; <span class="pl-s1">i</span> &lt; <span class="pl-s1">remarks</span>.<span class="pl-en">size</span>(); <span class="pl-s1">i</span>++) {
            <span class="pl-k">if</span> (<span class="pl-s1">i</span> != <span class="pl-c1">0</span>) {
                <span class="pl-s1">sb</span>.<span class="pl-en">append</span>(<span class="pl-s">","</span>);
            }
            <span class="pl-s1">sb</span>.<span class="pl-en">append</span>(<span class="pl-s">" (?, ?, ?)"</span>);
        }
        <span class="pl-smi">String</span> <span class="pl-s1">sql</span> = <span class="pl-s1">sb</span>.<span class="pl-en">toString</span>();
        <span class="pl-smi">PreparedStatement</span> <span class="pl-s1">statement</span> = <span class="pl-s1">connection</span>.<span class="pl-en">prepareStatement</span>(<span class="pl-s1">sql</span>);
        <span class="pl-smi">int</span> <span class="pl-s1">stride</span> = <span class="pl-c1">3</span>;
        <span class="pl-k">for</span> (<span class="pl-smi">int</span> <span class="pl-s1">i</span> = <span class="pl-c1">0</span>; <span class="pl-s1">i</span> &lt; <span class="pl-s1">remarks</span>.<span class="pl-en">size</span>(); <span class="pl-s1">i</span>++) {
            <span class="pl-smi">int</span> <span class="pl-s1">offset</span> = <span class="pl-s1">stride</span> * <span class="pl-s1">i</span>;
            <span class="pl-smi">RemarkPO</span> <span class="pl-s1">remark</span> = <span class="pl-s1">remarks</span>.<span class="pl-en">get</span>(<span class="pl-s1">i</span>);
            <span class="pl-s1">statement</span>.<span class="pl-en">setLong</span>(<span class="pl-c1">1</span> + <span class="pl-s1">offset</span>, <span class="pl-s1">remark</span>.<span class="pl-en">getUserId</span>());
            <span class="pl-s1">statement</span>.<span class="pl-en">setString</span>(<span class="pl-c1">2</span> + <span class="pl-s1">offset</span>, <span class="pl-s1">remark</span>.<span class="pl-en">getContent</span>());
            <span class="pl-s1">statement</span>.<span class="pl-en">setDate</span>(<span class="pl-c1">3</span> + <span class="pl-s1">offset</span>, <span class="pl-en">toSqlDate</span>(<span class="pl-s1">remark</span>.<span class="pl-en">getTime</span>()));
        }

        <span class="pl-s1">statement</span>.<span class="pl-en">execute</span>();

        <span class="pl-k">return</span> <span class="pl-c1">true</span>;
    }

    <span class="pl-k">private</span> <span class="pl-smi">java</span>.<span class="pl-smi">sql</span>.<span class="pl-smi">Date</span> <span class="pl-s1">toSqlDate</span>(<span class="pl-smi">Date</span> <span class="pl-s1">date</span>) {
        <span class="pl-k">return</span> <span class="pl-k">new</span> <span class="pl-smi">java</span>.<span class="pl-smi">sql</span>.<span class="pl-smi">Date</span>(<span class="pl-s1">date</span>.<span class="pl-en">getTime</span>());
    }</pre></div>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="package com.test.po;

import java.util.Date;

public class RemarkPO {
    private long id;
    private long userId;
    private String content;
    private Date time;

    public long getId() {
        return id;
    }

    public void setId(long id) {
        this.id = id;
    }

    public long getUserId() {
        return userId;
    }

    public void setUserId(long userId) {
        this.userId = userId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Date getTime() {
        return time;
    }

    public void setTime(Date time) {
        this.time = time;
    }
}
"><pre class="notranslate"><span class="pl-k">package</span> <span class="pl-s1">com</span>.<span class="pl-s1">test</span>.<span class="pl-s1">po</span>;

<span class="pl-k">import</span> <span class="pl-s1">java</span>.<span class="pl-s1">util</span>.<span class="pl-s1">Date</span>;

<span class="pl-k">public</span> <span class="pl-k">class</span> <span class="pl-smi">RemarkPO</span> {
    <span class="pl-k">private</span> <span class="pl-smi">long</span> <span class="pl-s1">id</span>;
    <span class="pl-k">private</span> <span class="pl-smi">long</span> <span class="pl-s1">userId</span>;
    <span class="pl-k">private</span> <span class="pl-smi">String</span> <span class="pl-s1">content</span>;
    <span class="pl-k">private</span> <span class="pl-smi">Date</span> <span class="pl-s1">time</span>;

    <span class="pl-k">public</span> <span class="pl-smi">long</span> <span class="pl-en">getId</span>() {
        <span class="pl-k">return</span> <span class="pl-s1">id</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">setId</span>(<span class="pl-smi">long</span> <span class="pl-s1">id</span>) {
        <span class="pl-smi">this</span>.<span class="pl-s1">id</span> = <span class="pl-s1">id</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">long</span> <span class="pl-en">getUserId</span>() {
        <span class="pl-k">return</span> <span class="pl-s1">userId</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">setUserId</span>(<span class="pl-smi">long</span> <span class="pl-s1">userId</span>) {
        <span class="pl-smi">this</span>.<span class="pl-s1">userId</span> = <span class="pl-s1">userId</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">String</span> <span class="pl-en">getContent</span>() {
        <span class="pl-k">return</span> <span class="pl-s1">content</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">setContent</span>(<span class="pl-smi">String</span> <span class="pl-s1">content</span>) {
        <span class="pl-smi">this</span>.<span class="pl-s1">content</span> = <span class="pl-s1">content</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">Date</span> <span class="pl-en">getTime</span>() {
        <span class="pl-k">return</span> <span class="pl-s1">time</span>;
    }

    <span class="pl-k">public</span> <span class="pl-smi">void</span> <span class="pl-en">setTime</span>(<span class="pl-smi">Date</span> <span class="pl-s1">time</span>) {
        <span class="pl-smi">this</span>.<span class="pl-s1">time</span> = <span class="pl-s1">time</span>;
    }
}</pre></div>
<ul dir="auto">
<li>server.yaml</li>
</ul>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="mode:
  type: Cluster
  repository:
    type: ZooKeeper
    props:
      namespace: governance_ds
      server-lists: localhost:2182
      retryIntervalMilliseconds: 500
      timeToLiveSeconds: 60
      maxRetries: 3
      operationTimeoutMilliseconds: 500
  overwrite: false

rules:
  - !AUTHORITY
    users:
      - root@%:123456
    provider:
      type: ALL_PRIVILEGES_PERMITTED
  - !TRANSACTION
    defaultType: LOCAL
    props:
      recoveryStoreUrl: jdbc:mysql://127.0.0.1:3306/jbossts
      recoveryStoreDataSource: com.mysql.jdbc.jdbc2.optional.MysqlDataSource
      recoveryStoreUser: root
      recoveryStorePassword: 12345678
  - !SQL_PARSER
    sqlCommentParseEnabled: true
    sqlStatementCache:
      initialCapacity: 2000
      maximumSize: 65535
      concurrencyLevel: 4
    parseTreeCache:
      initialCapacity: 128
      maximumSize: 1024
      concurrencyLevel: 4

props:
  max-connections-size-per-query: 1
  kernel-executor-size: 16 
  proxy-frontend-flush-threshold: 128 
  proxy-hint-enabled: false
  sql-show: true
  check-table-metadata-enabled: false
  show-process-list-enabled: false
  proxy-backend-query-fetch-size: -1
  check-duplicate-table-enabled: false
  proxy-frontend-executor-size: 0
  proxy-backend-executor-suitable: OLAP
  proxy-frontend-max-connections: 0 
  sql-federation-enabled: false
  proxy-backend-driver-type: JDBC
"><pre class="notranslate"><span class="pl-ent">mode</span>:
  <span class="pl-ent">type</span>: <span class="pl-s">Cluster</span>
  <span class="pl-ent">repository</span>:
    <span class="pl-ent">type</span>: <span class="pl-s">ZooKeeper</span>
    <span class="pl-ent">props</span>:
      <span class="pl-ent">namespace</span>: <span class="pl-s">governance_ds</span>
      <span class="pl-ent">server-lists</span>: <span class="pl-s">localhost:2182</span>
      <span class="pl-ent">retryIntervalMilliseconds</span>: <span class="pl-c1">500</span>
      <span class="pl-ent">timeToLiveSeconds</span>: <span class="pl-c1">60</span>
      <span class="pl-ent">maxRetries</span>: <span class="pl-c1">3</span>
      <span class="pl-ent">operationTimeoutMilliseconds</span>: <span class="pl-c1">500</span>
  <span class="pl-ent">overwrite</span>: <span class="pl-c1">false</span>

<span class="pl-ent">rules</span>:
  - <span class="pl-k">!AUTHORITY</span>
    <span class="pl-ent">users</span>:
      - <span class="pl-s">root@%:123456</span>
    <span class="pl-ent">provider</span>:
      <span class="pl-ent">type</span>: <span class="pl-s">ALL_PRIVILEGES_PERMITTED</span>
  - <span class="pl-k">!TRANSACTION</span>
    <span class="pl-ent">defaultType</span>: <span class="pl-s">LOCAL</span>
    <span class="pl-ent">props</span>:
      <span class="pl-ent">recoveryStoreUrl</span>: <span class="pl-s">jdbc:mysql://127.0.0.1:3306/jbossts</span>
      <span class="pl-ent">recoveryStoreDataSource</span>: <span class="pl-s">com.mysql.jdbc.jdbc2.optional.MysqlDataSource</span>
      <span class="pl-ent">recoveryStoreUser</span>: <span class="pl-s">root</span>
      <span class="pl-ent">recoveryStorePassword</span>: <span class="pl-c1">12345678</span>
  - <span class="pl-k">!SQL_PARSER</span>
    <span class="pl-ent">sqlCommentParseEnabled</span>: <span class="pl-c1">true</span>
    <span class="pl-ent">sqlStatementCache</span>:
      <span class="pl-ent">initialCapacity</span>: <span class="pl-c1">2000</span>
      <span class="pl-ent">maximumSize</span>: <span class="pl-c1">65535</span>
      <span class="pl-ent">concurrencyLevel</span>: <span class="pl-c1">4</span>
    <span class="pl-ent">parseTreeCache</span>:
      <span class="pl-ent">initialCapacity</span>: <span class="pl-c1">128</span>
      <span class="pl-ent">maximumSize</span>: <span class="pl-c1">1024</span>
      <span class="pl-ent">concurrencyLevel</span>: <span class="pl-c1">4</span>

<span class="pl-ent">props</span>:
  <span class="pl-ent">max-connections-size-per-query</span>: <span class="pl-c1">1</span>
  <span class="pl-ent">kernel-executor-size</span>: <span class="pl-c1">16</span> 
  <span class="pl-ent">proxy-frontend-flush-threshold</span>: <span class="pl-c1">128</span> 
  <span class="pl-ent">proxy-hint-enabled</span>: <span class="pl-c1">false</span>
  <span class="pl-ent">sql-show</span>: <span class="pl-c1">true</span>
  <span class="pl-ent">check-table-metadata-enabled</span>: <span class="pl-c1">false</span>
  <span class="pl-ent">show-process-list-enabled</span>: <span class="pl-c1">false</span>
  <span class="pl-ent">proxy-backend-query-fetch-size</span>: <span class="pl-c1">-1</span>
  <span class="pl-ent">check-duplicate-table-enabled</span>: <span class="pl-c1">false</span>
  <span class="pl-ent">proxy-frontend-executor-size</span>: <span class="pl-c1">0</span>
  <span class="pl-ent">proxy-backend-executor-suitable</span>: <span class="pl-s">OLAP</span>
  <span class="pl-ent">proxy-frontend-max-connections</span>: <span class="pl-c1">0</span> 
  <span class="pl-ent">sql-federation-enabled</span>: <span class="pl-c1">false</span>
  <span class="pl-ent">proxy-backend-driver-type</span>: <span class="pl-s">JDBC</span>
</pre></div>
<ul dir="auto">
<li>config-sharding.yaml</li>
</ul>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="schemaName: sharding_db

dataSources:
  p:
    url: jdbc:mysql://localhost:3306/p?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
  p1:
    url: jdbc:mysql://localhost:3306/p1?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai
    username: root
    password: 123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1

rules:
  - !SHARDING
    tables:
      remark:
        actualDataNodes: p.remark,p$-&gt;{1..1}.remark
        databaseStrategy:
          standard:
            shardingColumn: userid
            shardingAlgorithmName: database_inline
    shardingAlgorithms:
      database_inline:
        type: INLINE
        props:
          algorithm-expression: p$-&gt;{userid&lt;3?&quot;&quot;:(String)((int)((userid-3)/2)+1)}"><pre class="notranslate"><span class="pl-ent">schemaName</span>: <span class="pl-s">sharding_db</span>

<span class="pl-ent">dataSources</span>:
  <span class="pl-ent">p</span>:
    <span class="pl-ent">url</span>: <span class="pl-s">jdbc:mysql://localhost:3306/p?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai</span>
    <span class="pl-ent">username</span>: <span class="pl-s">root</span>
    <span class="pl-ent">password</span>: <span class="pl-c1">123456</span>
    <span class="pl-ent">connectionTimeoutMilliseconds</span>: <span class="pl-c1">30000</span>
    <span class="pl-ent">idleTimeoutMilliseconds</span>: <span class="pl-c1">60000</span>
    <span class="pl-ent">maxLifetimeMilliseconds</span>: <span class="pl-c1">1800000</span>
    <span class="pl-ent">maxPoolSize</span>: <span class="pl-c1">50</span>
    <span class="pl-ent">minPoolSize</span>: <span class="pl-c1">1</span>
  <span class="pl-ent">p1</span>:
    <span class="pl-ent">url</span>: <span class="pl-s">jdbc:mysql://localhost:3306/p1?useUnicode=true&amp;characterEncoding=utf8&amp;useSSL=false&amp;serverTimezone=Asia/Shanghai</span>
    <span class="pl-ent">username</span>: <span class="pl-s">root</span>
    <span class="pl-ent">password</span>: <span class="pl-c1">123456</span>
    <span class="pl-ent">connectionTimeoutMilliseconds</span>: <span class="pl-c1">30000</span>
    <span class="pl-ent">idleTimeoutMilliseconds</span>: <span class="pl-c1">60000</span>
    <span class="pl-ent">maxLifetimeMilliseconds</span>: <span class="pl-c1">1800000</span>
    <span class="pl-ent">maxPoolSize</span>: <span class="pl-c1">50</span>
    <span class="pl-ent">minPoolSize</span>: <span class="pl-c1">1</span>

<span class="pl-ent">rules</span>:
  - <span class="pl-k">!SHARDING</span>
    <span class="pl-ent">tables</span>:
      <span class="pl-ent">remark</span>:
        <span class="pl-ent">actualDataNodes</span>: <span class="pl-s">p.remark,p$-&gt;{1..1}.remark</span>
        <span class="pl-ent">databaseStrategy</span>:
          <span class="pl-ent">standard</span>:
            <span class="pl-ent">shardingColumn</span>: <span class="pl-s">userid</span>
            <span class="pl-ent">shardingAlgorithmName</span>: <span class="pl-s">database_inline</span>
    <span class="pl-ent">shardingAlgorithms</span>:
      <span class="pl-ent">database_inline</span>:
        <span class="pl-ent">type</span>: <span class="pl-s">INLINE</span>
        <span class="pl-ent">props</span>:
          <span class="pl-ent">algorithm-expression</span>: <span class="pl-s">p$-&gt;{userid&lt;3?"":(String)((int)((userid-3)/2)+1)}</span></pre></div>
<ul dir="auto">
<li>create table statement</li>
</ul>
<div class="highlight highlight-source-sql notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/*
 Navicat Premium Data Transfer

 Source Server         : localhost
 Source Server Type    : MySQL
 Source Server Version : 50708
 Source Host           : localhost:3306
 Source Schema         : p

 Target Server Type    : MySQL
 Target Server Version : 50708
 File Encoding         : 65001

 Date: 12/05/2022 16:42:31
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for remark
-- ----------------------------
DROP TABLE IF EXISTS `remark`;
CREATE TABLE `remark`  (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `userid` int(11) NOT NULL,
  `content` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
  `time` datetime NOT NULL,
  PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = COMPACT;

SET FOREIGN_KEY_CHECKS = 1;
"><pre class="notranslate"><span class="pl-c"><span class="pl-c">/*</span></span>
<span class="pl-c"> Navicat Premium Data Transfer</span>
<span class="pl-c"></span>
<span class="pl-c"> Source Server         : localhost</span>
<span class="pl-c"> Source Server Type    : MySQL</span>
<span class="pl-c"> Source Server Version : 50708</span>
<span class="pl-c"> Source Host           : localhost:3306</span>
<span class="pl-c"> Source Schema         : p</span>
<span class="pl-c"></span>
<span class="pl-c"> Target Server Type    : MySQL</span>
<span class="pl-c"> Target Server Version : 50708</span>
<span class="pl-c"> File Encoding         : 65001</span>
<span class="pl-c"></span>
<span class="pl-c"> Date: 12/05/2022 16:42:31</span>
<span class="pl-c"><span class="pl-c">*/</span></span>

<span class="pl-k">SET</span> NAMES utf8mb4;
<span class="pl-k">SET</span> FOREIGN_KEY_CHECKS <span class="pl-k">=</span> <span class="pl-c1">0</span>;

<span class="pl-c"><span class="pl-c">--</span> ----------------------------</span>
<span class="pl-c"><span class="pl-c">--</span> Table structure for remark</span>
<span class="pl-c"><span class="pl-c">--</span> ----------------------------</span>
<span class="pl-k">DROP</span> <span class="pl-k">TABLE</span> IF EXISTS <span class="pl-s"><span class="pl-pds">`</span>remark<span class="pl-pds">`</span></span>;
<span class="pl-k">CREATE</span> <span class="pl-k">TABLE</span> `<span class="pl-en">remark</span>`  (
  <span class="pl-s"><span class="pl-pds">`</span>id<span class="pl-pds">`</span></span> <span class="pl-k">int</span>(<span class="pl-c1">11</span>) <span class="pl-k">NOT NULL</span> AUTO_INCREMENT,
  <span class="pl-s"><span class="pl-pds">`</span>userid<span class="pl-pds">`</span></span> <span class="pl-k">int</span>(<span class="pl-c1">11</span>) <span class="pl-k">NOT NULL</span>,
  <span class="pl-s"><span class="pl-pds">`</span>content<span class="pl-pds">`</span></span> <span class="pl-k">varchar</span>(<span class="pl-c1">255</span>) CHARACTER <span class="pl-k">SET</span> utf8 COLLATE utf8_general_ci <span class="pl-k">NOT NULL</span>,
  <span class="pl-s"><span class="pl-pds">`</span>time<span class="pl-pds">`</span></span> datetime <span class="pl-k">NOT NULL</span>,
  <span class="pl-k">PRIMARY KEY</span> (<span class="pl-s"><span class="pl-pds">`</span>id<span class="pl-pds">`</span></span>) USING BTREE
) ENGINE <span class="pl-k">=</span> InnoDB AUTO_INCREMENT <span class="pl-k">=</span> <span class="pl-c1">6</span> CHARACTER <span class="pl-k">SET</span> <span class="pl-k">=</span> utf8 COLLATE <span class="pl-k">=</span> utf8_general_ci ROW_FORMAT <span class="pl-k">=</span> COMPACT;

<span class="pl-k">SET</span> FOREIGN_KEY_CHECKS <span class="pl-k">=</span> <span class="pl-c1">1</span>;
</pre></div>