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

   # 1. vertical sharding table
   ```properties 
    table named t_admin has 13 column .  ---vertical sharding--->  three 
tables, each table with some column 
   ```
   
   # 2. java 
   ```java
      public static void main(String[] args) throws SQLException {
   
           Map<String, DataSource> mapDatasource = new HashMap<>();
           DruidDataSource dataSource  = new DruidDataSource();
           dataSource.setDriverClassName(Driver.class.getName());
           
dataSource.setUrl("jdbc:mysql://192.168.191.148:3306/admin_account?serverTimezone=UTC");
           dataSource.setUsername("root");
           dataSource.setPassword("rootroot");
   
           DruidDataSource dataSource1  = new DruidDataSource();
           dataSource1.setDriverClassName(Driver.class.getName());
           
dataSource1.setUrl("jdbc:mysql://192.168.191.148:3307/admin_basic?serverTimezone=UTC");
           dataSource1.setUsername("root");
           dataSource1.setPassword("rootroot");
   
           DruidDataSource dataSource2  = new DruidDataSource();
           dataSource2.setDriverClassName(Driver.class.getName());
           
dataSource2.setUrl("jdbc:mysql://192.168.191.148:3308/admin_contact?serverTimezone=UTC");
           dataSource2.setUsername("root");
           dataSource2.setPassword("rootroot");
   
           mapDatasource.put("xxxx",dataSource);
           mapDatasource.put("yyyy",dataSource1);
           mapDatasource.put("zzzz",dataSource2);
   
           ShardingRuleConfiguration shardingRuleConfiguration  = new 
ShardingRuleConfiguration();
           ShardingTableRuleConfiguration configuration  = new 
ShardingTableRuleConfiguration("t_admin","xxxx.t_admin_account,yyyy.t_admin_basic,zzzz.t_admin_contact");
           shardingRuleConfiguration.getTables().add(configuration);
          //how to set vertical Sharding Table rule ?
          //how to set vertical Sharding Table rule ?
          //how to set vertical Sharding Table rule ?
           DataSource abc = 
ShardingSphereDataSourceFactory.createDataSource("abc", null, mapDatasource, 
Collections.singleton(shardingRuleConfiguration), new Properties());
   
           String sql = "insert into 
t_admin(admin_id,admin_account,admin_name,admin_phone) 
values(1,'aaaaa','bbbbb','13333333333')";
           abc.getConnection().prepareStatement(sql).execute();
       }
   
   ```
   # 3. error info 
   ```java
   Exception in thread "main" java.sql.SQLException: Unknown exception: Insert 
statement does not support sharding table routing to multiple data nodes.
        at 
org.apache.shardingsphere.infra.util.exception.external.sql.ShardingSphereSQLException.toSQLException(ShardingSphereSQLException.java:62)
        at 
org.apache.shardingsphere.dialect.SQLExceptionTransformEngine.toSQLException(SQLExceptionTransformEngine.java:62)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.execute(ShardingSpherePreparedStatement.java:419)
   ```
   
   
   


-- 
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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to