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/11/13 13:53:14 UTC

[GitHub] [shardingsphere] jianzh5 opened a new issue, #22152: how to create table using ShardingSphereDataSource ds

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

   I want auto create tables by days , i using ShardingSphereDataSource like this
   
   ```java
    private void createTable(DataSource dataSource, String logicTable) {
           String sql = "Create table if not exists `T_EVENT_20221113` like `T_EVENT_20221110`";
           try(Connection connection = dataSource.getConnection(); Statement statement = connection.createStatement()){
               statement.execute(sql);
           }catch (SQLException e){
               throw new RuntimeException("");
           }
       }
   ```
   
   i have two datasource on application.yml,ds0 and ds1,this procedure only takes effect on ds0。
   
   ![image](https://user-images.githubusercontent.com/5998464/201525357-75e13781-0b7e-49da-b939-f8f8a7f96cdd.png)
   
   
   How to get the program to work in both ds0 and ds1?
   


-- 
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 commented on issue #22152: how to create table using ShardingSphereDataSource ds

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

   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] RaigorJiang closed issue #22152: how to create table using ShardingSphereDataSource ds

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #22152: how to create table using    ShardingSphereDataSource ds
URL: https://github.com/apache/shardingsphere/issues/22152


-- 
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] fang1025 commented on issue #22152: how to create table using ShardingSphereDataSource ds

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

   you should get ShardingSphereMetaData first. 
   then you can get all databases and excute you function 'createTable' for each database.
   
   
   


-- 
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] sandynz commented on issue #22152: how to create table using ShardingSphereDataSource ds

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

   Hi @jianzh5 , if your `dataSource` is ` ShardingSphereDataSource` (which includes ds0 and ds1), then it'll be routed to ds0 and ds1 automatically.
   
   Is there already existing table? Does CRUD work?
   


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