You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/10/10 06:37:34 UTC

[GitHub] [shardingsphere] ssz-plus opened a new issue, #19242: Can not support multiple different database.

ssz-plus opened a new issue, #19242:
URL: https://github.com/apache/shardingsphere/issues/19242

   ## Bug Report
   Hello, We found a problem with cross-database queries.
   When our sql statement involves a data table located in a different database, an error is reported:
   ![image](https://user-images.githubusercontent.com/109347245/179198213-723d7382-d123-4454-9753-5cfb5315bb9b.png)
   Regarding the database version we use and the SQL executed as follows:
   
   ### Mysql version
   Mysql 5.7.18 and Mysql 8.0.22
   ### Which version of ShardingSphere did you use?
   5.1.1 and 5.1.2
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-JDBC
   ### Expected behavior
   We hope to support cross-database join queries.
   ### Actual behavior
   Unfortunately, it reported an error: [Error preparing statement.  Cause: java.lang.IllegalStateException: Can not support multiple different database.]
   
   ### Our database table distribution:
   <img width="210" alt="image" src="https://user-images.githubusercontent.com/109347245/179199111-44a5fe8e-ba56-4211-bd5e-571da6beed2e.png">
   
   ### Our application.yml 
   <img width="896" alt="image" src="https://user-images.githubusercontent.com/109347245/179537234-55c79424-2ad7-4e6c-8137-7084a3703962.png">
   
   ### Our query statement:
   Preparing: select t02.id, t02.system_id from test_02.t_wr_readonly t02 LEFT JOIN test_03.t_dic_metrics t03_metrics ON t02.id = t03_metrics.id where t02.id = 1;
   
   Caused by: java.lang.IllegalStateException: Can not support multiple different database.
   	at com.google.common.base.Preconditions.checkState(Preconditions.java:508) ~[guava-29.0-jre.jar:?]
   	at org.apache.shardingsphere.infra.binder.segment.table.TablesContext.getDatabaseName(TablesContext.java:297) ~[shardingsphere-infra-binder-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.getSchema(SelectStatementContext.java:132) ~[shardingsphere-infra-binder-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.infra.binder.statement.dml.SelectStatementContext.<init>(SelectStatementContext.java:111) ~[shardingsphere-infra-binder-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.getDMLStatementContext(SQLStatementContextFactory.java:146) ~[shardingsphere-infra-binder-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:129) ~[shardingsphere-infra-binder-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.infra.binder.SQLStatementContextFactory.newInstance(SQLStatementContextFactory.java:114) ~[shardingsphere-infra-binder-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:181) ~[shardingsphere-jdbc-core-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:149) ~[shardingsphere-jdbc-core-5.1.1.jar:5.1.1]
   	at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:80) ~[shardingsphere-jdbc-core-5.1.1.jar:5.1.1]
   	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
   
   
   @terrymanu  Please help me with this problem, thank you 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.

To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] commented on issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on issue #19242:
URL: https://github.com/apache/shardingsphere/issues/19242#issuecomment-1272349346

   Hello , this issue has not received a reply for several days.
   This issue is supposed to be closed.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] github-actions[bot] closed issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #19242: Can not support multiple different database.
URL: https://github.com/apache/shardingsphere/issues/19242


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] forachange commented on issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
forachange commented on issue #19242:
URL: https://github.com/apache/shardingsphere/issues/19242#issuecomment-1188765799

   mark,I have the same problem.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] terrymanu commented on issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
terrymanu commented on issue #19242:
URL: https://github.com/apache/shardingsphere/issues/19242#issuecomment-1193576853

   No plan to support for now, can you unify your databases version?


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN commented on issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on issue #19242:
URL: https://github.com/apache/shardingsphere/issues/19242#issuecomment-1364913450

   Please try the SQL federation in latest version.


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] rehuhu commented on issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
rehuhu commented on issue #19242:
URL: https://github.com/apache/shardingsphere/issues/19242#issuecomment-1233688862

   @ssz-plus can it run when the Preparing is 
   select t02.id, t02.system_id from test_02.t_wr_readonly t02 where t02.id = 1;


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] TeslaCN closed issue #19242: Can not support multiple different database.

Posted by GitBox <gi...@apache.org>.
TeslaCN closed issue #19242: Can not support multiple different database.
URL: https://github.com/apache/shardingsphere/issues/19242


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org