<h2 dir="auto">Bug Report</h2>
<p dir="auto"><strong>For English only</strong>, other languages will not accept.</p>
<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/incubator-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 <strong>more than 7 days</strong> 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">4.0.0</p>
<h3 dir="auto">Which project did you use? Sharding-JDBC or Sharding-Proxy?</h3>
<p dir="auto">Sharding-JDBC</p>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">The hintManager.setDatabaseShardingValue do not work,In the ShardingSphere-example , the <code class="notranslate">the hint-raw-jdbc-example</code> project don't work as expect,when I choose the type HintType TYPE = HintType.DATABASE_ONLY，the expected behavior  should be  all the sql  routing to one datasource which is set by   hintManager.setDatabaseShardingValue(1L);</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">the hint does not work ,sql route to all datasouces，here is the log</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[INFO ] 2020-02-12 12:56:13,923 --main-- [ShardingSphere-SQL] Rule Type: sharding 
[INFO ] 2020-02-12 12:56:13,924 --main-- [ShardingSphere-SQL] Logic SQL: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
[INFO ] 2020-02-12 12:56:13,925 --main-- [ShardingSphere-SQL] SQLStatement: SelectSQLStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@59496961, tablesContext=TablesContext(tables=[Table(name=t_order, alias=Optional.of(o)), Table(name=t_order_item, alias=Optional.of(i))], schema=Optional.absent())), projectionsContext=ProjectionsContext(startIndex=7, stopIndex=9, distinctRow=false, projections=[ShorthandProjection(owner=Optional.of(i))], columnLabels=[order_item_id, order_id, user_id, status]), groupByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.groupby.GroupByContext@408b87aa, orderByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.orderby.OrderByContext@79b08632, paginationContext=org.apache.shardingsphere.sql.parser.relation.segment.select.pagination.PaginationContext@787f32b7, containsSubquery=false) 
[INFO ] 2020-02-12 12:56:13,932 --main-- [ShardingSphere-SQL] Actual SQL: ds_0 ::: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
[INFO ] 2020-02-12 12:56:13,932 --main-- [ShardingSphere-SQL] Actual SQL: ds_1 ::: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
"><pre class="notranslate"><code class="notranslate">[INFO ] 2020-02-12 12:56:13,923 --main-- [ShardingSphere-SQL] Rule Type: sharding 
[INFO ] 2020-02-12 12:56:13,924 --main-- [ShardingSphere-SQL] Logic SQL: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
[INFO ] 2020-02-12 12:56:13,925 --main-- [ShardingSphere-SQL] SQLStatement: SelectSQLStatementContext(super=CommonSQLStatementContext(sqlStatement=org.apache.shardingsphere.sql.parser.sql.statement.dml.SelectStatement@59496961, tablesContext=TablesContext(tables=[Table(name=t_order, alias=Optional.of(o)), Table(name=t_order_item, alias=Optional.of(i))], schema=Optional.absent())), projectionsContext=ProjectionsContext(startIndex=7, stopIndex=9, distinctRow=false, projections=[ShorthandProjection(owner=Optional.of(i))], columnLabels=[order_item_id, order_id, user_id, status]), groupByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.groupby.GroupByContext@408b87aa, orderByContext=org.apache.shardingsphere.sql.parser.relation.segment.select.orderby.OrderByContext@79b08632, paginationContext=org.apache.shardingsphere.sql.parser.relation.segment.select.pagination.PaginationContext@787f32b7, containsSubquery=false) 
[INFO ] 2020-02-12 12:56:13,932 --main-- [ShardingSphere-SQL] Actual SQL: ds_0 ::: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 
[INFO ] 2020-02-12 12:56:13,932 --main-- [ShardingSphere-SQL] Actual SQL: ds_1 ::: SELECT i.* FROM t_order o, t_order_item i WHERE o.order_id = i.order_id 

</code></pre></div>
<h3 dir="auto">Reason analyze (If you can)</h3>
<p dir="auto">int the 3.1.0 version .there is a class <code class="notranslate">DatabaseHintRoutingEngine</code> to route to some certain sharding database without sharding tables,SQL parse and rewrite phase will be skipped,however ,in the 4.0.0 verision, there is no class to use the value I set in the hintManager, because there is no caller of the method  <code class="notranslate">getDatabaseShardingValues</code></p>
<div class="highlight highlight-source-java notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content=" /**
     * Get database sharding values.
     *
     * @return database sharding values
     */
    public static Collection&lt;Comparable&lt;?&gt;&gt; getDatabaseShardingValues() {
        return getDatabaseShardingValues(&quot;&quot;);
    }"><pre class="notranslate"> <span class="pl-c">/**</span>
<span class="pl-c">     * Get database sharding values.</span>
<span class="pl-c">     *</span>
<span class="pl-c">     * @return database sharding values</span>
<span class="pl-c">     */</span>
    <span class="pl-k">public</span> <span class="pl-k">static</span> <span class="pl-smi">Collection</span>&lt;<span class="pl-smi">Comparable</span>&lt;?&gt;&gt; <span class="pl-s1">getDatabaseShardingValues</span>() {
        <span class="pl-k">return</span> <span class="pl-en">getDatabaseShardingValues</span>(<span class="pl-s">""</span>);
    }</pre></div>
<h3 dir="auto">Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.</h3>
<p dir="auto">git clone the project, <a href="https://github.com/apache/incubator-shardingsphere-example">https://github.com/apache/incubator-shardingsphere-example</a><br>
switch to 4.0.0, chage the HintType to HintType.DATABASE_ONLY and run the<br>
ExampleMain</p>
<h3 dir="auto">Example codes for reproduce this issue (such as a github link).</h3>
<p dir="auto"><a href="https://github.com/apache/incubator-shardingsphere-example/tree/dev/sharding-jdbc-example/other-feature-example/hint-example">https://github.com/apache/incubator-shardingsphere-example/tree/dev/sharding-jdbc-example/other-feature-example/hint-example</a></p>
<p dir="auto">I have reproduced the behavior as <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/lvye351/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/lvye351">@lvye351</a> says in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="608983401" data-permission-text="Title is private" data-url="https://github.com/apache/shardingsphere/issues/5383" data-hovercard-type="issue" data-hovercard-url="/apache/shardingsphere/issues/5383/hovercard" href="https://github.com/apache/shardingsphere/issues/5383">#5383</a>. The keyGenerator doesn't work in the transaction-2pc-xa-raw-jdbc sample module when a oracle database 12c and ojbdc8.jar used.</p>
<p dir="auto">The log is as follows,<br>
<a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/9602831/80979380-db422480-8e59-11ea-8043-0b38dedcad5b.png"><img src="https://user-images.githubusercontent.com/9602831/80979380-db422480-8e59-11ea-8043-0b38dedcad5b.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">It seems that when table t_order created, its tableMetaData doesn't put into schemaMetaData.<br>
I will try to find out the reason and fix it.</p>