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:30:33 UTC

[GitHub] [shardingsphere] q3056917665 opened a new issue, #17482: Cross database query ,prompt: schme not exist

q3056917665 opened a new issue, #17482:
URL: https://github.com/apache/shardingsphere/issues/17482

   version
   
   ```
     <groupId>org.apache.shardingsphere</groupId>
     <artifactId>shardingsphere-jdbc-core</artifactId>
     <version>5.1.1</version>
   ```
   
   When I cross database query,it prompt "schme not exist" for me.
   So what configuration does it need?of course I didn't find this configuration,
   or it not support Cross database query.


-- 
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] RaigorJiang closed issue #17482: Cross database query ,prompt: schme not exist

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #17482: Cross database query ,prompt:  schme not exist
URL: https://github.com/apache/shardingsphere/issues/17482


-- 
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] q3056917665 commented on issue #17482: Cross database query ,prompt: schme not exist

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

   > 
   If I have a lot of nothing  database,  but I need to use them now, what should I do, do I using one Configure one?
   


-- 
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 #17482: Cross database query ,prompt: schme not exist

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

   Can you provide the full stack trace?


-- 
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] commented on issue #17482: Cross database query ,prompt: schme not exist

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

   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] RaigorJiang commented on issue #17482: Cross database query ,prompt: schme not exist

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on issue #17482:
URL: https://github.com/apache/shardingsphere/issues/17482#issuecomment-1407574404

   Closed due to no response.
   If this problem persists, please reopen it or submit a new one.


-- 
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] q3056917665 commented on issue #17482: Cross database query ,prompt: schme not exist

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

   > 您可以配置数据源和分片规则。如:`actualDataNodes`
   > 
   > ```yaml
   > dataSources:
   >   ds_0:
   >     url: xxx
   >   ds_1:
   >     url: xxx
   > rules:
   >   - !SHARDING
   >     bindingTables: []
   >     defaultDatabaseStrategy:
   >       none:
   >     defaultTableStrategy:
   >       none:
   >     keyGenerators:
   >       snowflake:
   >         props:
   >           worker-id: 123
   >         type: SNOWFLAKE
   >     tables:
   >       bmsql_config:
   >         actualDataNodes: ds_0.bmsql_config
   > ```
   
   If my two databases have tables with the same name, but they have nothing to do with each other, is there a 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] q3056917665 commented on issue #17482: Cross database query ,prompt: schme not exist

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

   > @q3056917665 Please provide your sql and sharding configuration.
   ```
       public DataSource getShardingDataSource() {
           Map<String, DataSource> dataSourceMap = new HashMap<>();
           dataSourceMap.put("ds", dataSource);
           dataSourceMap.put("dswei", dataSourceWei);
   
           List<ShardingTableRuleConfiguration> tableRuleConfigs = getTableRuleConfigs();
   
           // 配置分片规则
           ShardingRuleConfiguration shardingRuleConfiguration = new ShardingRuleConfiguration();
   
           for (ShardingTableRuleConfiguration tableRuleConfig : tableRuleConfigs) {
               shardingRuleConfiguration.getTables().add(tableRuleConfig);
   
   
           }
           Properties datePreciseShardingAlgorithmProps = new Properties();
           datePreciseShardingAlgorithmProps.setProperty("algorithm-expression", String.valueOf(datePreciseShardingAlgorithm));
           shardingRuleConfiguration.getShardingAlgorithms().put("datePreciseShardingAlgorithm", new ShardingSphereAlgorithmConfiguration(datePreciseShardingAlgorithm.getType(), datePreciseShardingAlgorithmProps));
   
           Properties properties = new Properties();
           properties.setProperty("show_sql", "true");
           properties.setProperty("allow.range.query.with.inline.sharding", "true");
           //设置连接数,这里目前我只知道能加快table load 速度
           properties.setProperty("max.connections.size.per.query", "200");
           // 获取数据源对象
           try {
               //创建sharding数据源
               logger.info("sharding开始创建数据源");
               long time = System.currentTimeMillis();
               DataSource dataSource = ShardingSphereDataSourceFactory.createDataSource(dataSourceMap, Lists.newArrayList(shardingRuleConfiguration), properties);
               logger.info("sharding创建数据源结束,time:{}", (System.currentTimeMillis() - time));
               return dataSource;
           } catch (SQLException throwables) {
               logger.info("ShardingSphereConfig 创建ShardingDataSource失败", throwables);
   
           }
           return dataSource;
       }
   
   
       private List<ShardingTableRuleConfiguration> getTableRuleConfigs() {
   
           List<ShardingTableRuleConfiguration> result = new ArrayList<>();
   
           ShardingTableRuleConfiguration system_event_campus_count = new ShardingTableRuleConfiguration("system_event_campus_count", "dswei.system_event_campus_count_${1..13}");
           system_event_campus_count.setDatabaseShardingStrategy(new NoneShardingStrategyConfiguration());
           system_event_campus_count.setTableShardingStrategy(new StandardShardingStrategyConfiguration("record_date", "datePreciseShardingAlgorithm"));
           system_event_campus_count.setKeyGenerateStrategy(new KeyGenerateStrategyConfiguration("id", "SNOWFLAKE"));
           result.add(system_event_campus_count);
           return result;
       }
   ```
   
   springdatajpa
   ```
   SELECT secc.campusid, c.person_type, SUM(secc.total_count)   FROM weixin.system_event_campus_count secc  INNER JOIN weixin.system_event_config c ON c.id = secc.event_configid  WHERE c.is_uv = 1 AND secc.orgcode = ?1 AND secc.record_date = ?2
   ```


-- 
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] q3056917665 commented on issue #17482: Cross database query ,prompt: schme not exist

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

   > 您可以配置数据源和分片规则。如:`actualDataNodes`
   > 
   > ```yaml
   > dataSources:
   >   ds_0:
   >     url: xxx
   >   ds_1:
   >     url: xxx
   > rules:
   >   - !SHARDING
   >     bindingTables: []
   >     defaultDatabaseStrategy:
   >       none:
   >     defaultTableStrategy:
   >       none:
   >     keyGenerators:
   >       snowflake:
   >         props:
   >           worker-id: 123
   >         type: SNOWFLAKE
   >     tables:
   >       bmsql_config:
   >         actualDataNodes: ds_0.bmsql_config
   > ```
   
   
   If I have a lot of nothing database, but I need to use them now, what should I do, do I using one Configure one?
   
   


-- 
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 #17482: Cross database query ,prompt: schme not exist

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

   You may configure data sources and `actualDataNodes` in sharding rule. Such as:
   
   ```yaml
   dataSources:
     ds_0:
       url: xxx
     ds_1:
       url: xxx
   rules:
     - !SHARDING
       bindingTables: []
       defaultDatabaseStrategy:
         none:
       defaultTableStrategy:
         none:
       keyGenerators:
         snowflake:
           props:
             worker-id: 123
           type: SNOWFLAKE
       tables:
         bmsql_config:
           actualDataNodes: ds_0.bmsql_config
   ```


-- 
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] strongduanmu commented on issue #17482: Cross database query ,prompt: schme not exist

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

   @q3056917665 Please provide your sql and sharding configuration.


-- 
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 #17482: Cross database query ,prompt: schme not exist

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed issue #17482: Cross database query ,prompt:  schme not exist
URL: https://github.com/apache/shardingsphere/issues/17482


-- 
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