ChrisBamaofan opened a new issue #2882: 库1的分表关联库2的不分表,使用库1的
URL: https://github.com/apache/incubator-shardingsphere/issues/2882
 
 
   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/incubator-shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response **more than 7 days** and we cannot reproduce it on current 
information, we will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### Which version of ShardingSphere did you use?
   <dependency>
        <groupId>org.apache.shardingsphere</groupId>
        <artifactId>sharding-jdbc-core</artifactId>
        <version>4.0.0-RC1</version>
   </dependency>
   <dependency>
        <groupId>org.apache.shardingsphere</groupId>
        <artifactId>sharding-jdbc-spring-namespace</artifactId>
        <version>4.0.0-RC1</version>
   </dependency>
   
   ### Which project did you use? Sharding-JDBC or Sharding-Proxy?
   Sharding-JDBC
   
   ### Expected behavior
   -- simple select sql
   SELECT
        t0.userid,
        t1.userType
   FROM
        'database0'.table0 t0
   LEFT JOIN 'database1'.table1 t1 ON t0.id = t1.id;
   execute without error.
   
   ### Actual behavior
   error occured when executing the upper sql.
   error detail: cannot find table 'database0.table1',Cause: 
c.m.j.e.jdbc4.MySQLSyntaxErrorException: Table 'database0.table1' doesn't exist
   
   ### Reason analyze (If you can)
   i config the ds0 as the datasource to split table .(table split,no database 
split).In the select sql ,i need to join a table in ds_default,and table1 not 
exists in ds0.When i execute the upper sql,the shardingjdbc sql rewriter change 
the origin sql into 
   SELECT
        t0.userid,
        t1.userType
   FROM
        'database0'.table0 t0
   LEFT JOIN 'database0'.table1 t1 ON t0.id = t1.id;
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   
   the core config in my xml file is shown as following:
        <bean id="ds0" class="org.apache.commons.dbcp2.BasicDataSource" 
destroy-method="close">
           <property name="driverClassName" value="clazz" />
           <property name="url" value="jdbc:mysql://ip/database0?useSSL=false" 
/>
           <property name="username" value="usr" />
           <property name="password" value="pwd" />
       </bean>
   
       <!--默认数据源 tzadmin.-->
       <bean id="ds_default" class="org.apache.commons.dbcp2.BasicDataSource" 
destroy-method="close">
           <property name="driverClassName" value="clazz" />
           <property name="url" 
value="jdbc:mysql://ip:port/database1?useSSL=false" />
           <property name="username" value="usr" />
           <property name="password" value="pwd" />
       </bean>
        
        <sharding:data-source id="shardingReadOnlyDataSource">
           <sharding:sharding-rule data-source-names="ds0"
                                   default-data-source-name="ds_default"
                                   default-database-strategy-ref="noneStrategy"
                                   default-table-strategy-ref="noneStrategy">
               <sharding:table-rules>
                   <sharding:table-rule logic-table="table0"
                                        
actual-data-nodes="ds0.table0_$->{1..12}"
                                        
table-strategy-ref="tableShardingStrategy"
                                        key-generator-ref="orderKeyGenerator" />
               </sharding:table-rules>
               <sharding:binding-table-rules>
                   <sharding:binding-table-rule logic-tables="table0" />
               </sharding:binding-table-rules>
   
           </sharding:sharding-rule>
           <sharding:props>
               <prop key="sql.show">true</prop>
               <prop key="executor.size">2</prop>
           </sharding:props>
       </sharding:data-source>
   <datasource>
   
   ### Example codes for reproduce this issue (such as a github link).
   I have provide the namespace configuration file and the example sql and 
explain the situation ,please help me with my question.THX very much.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to