You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "liruhui (via GitHub)" <gi...@apache.org> on 2023/03/21 02:38:11 UTC

[GitHub] [shardingsphere] liruhui opened a new issue, #24704: Java API

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

   # 1. Official document
   ![image](https://user-images.githubusercontent.com/24687986/226504809-176900f4-aaa8-4f02-ae3d-7dd4aa87588a.png)
   
   # 2.  My needs
   ![image](https://user-images.githubusercontent.com/24687986/226505288-a8b2899f-76dd-47f7-b93f-2cbd035c5f62.png)
   
   # 3. javaCode 
   ![image](https://user-images.githubusercontent.com/24687986/226505831-de597d2a-ea6a-4597-9862-43c9ca5fc13b.png)
   
   # 4. I do not  know  how to code correctly  please Tell me 
   
   


-- 
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 #24704: Vertical sharding how to code for java API

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

   Hi @liruhui 
   There are two ways:
   1. If the table already exists in a different DB, no configuration is required, and ShardingSphere can route correctly;
   2. If you want to execute CREATE TABLE through ShardingSphere, you can only set data nodes in the sharding table rule like the configuration you provided.


-- 
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 #24704: Vertical sharding how to code for java API

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang closed issue #24704: Vertical sharding  how to code for java API 
URL: https://github.com/apache/shardingsphere/issues/24704


-- 
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 #24704: Java API

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

   Could you change the title for search friendly?


-- 
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 #24704: Vertical sharding how to code for java API

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

   Closed for #25078.


-- 
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] liruhui commented on issue #24704: Vertical sharding how to code for java API

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

   > Could you change the title for search friendly? The title does not make sense.
   
   title changed  but  The problem has not been solved.


-- 
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] liruhui commented on issue #24704: Vertical sharding how to code for java API

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

   @RaigorJiang  
   > 1. If the table already exists in a different DB, no configuration is required, and ShardingSphere can route correctly;
   > 2. If you want to execute CREATE TABLE through ShardingSphere, you can only set data nodes in the sharding table rule like the configuration you provided.
   
   ```
   vertical sharding database  not  need  any configuration   thit is OK  , 
   but  vertical sharding table no configuration is error 
   
   for example 
   
   one table has three column (id, name age) , ->vertical sharding table->  table_1 has column(id,name), table_2 has 
   colume(id,age)    columes named  "name" and “age” in different table   maybe table name is  different
   ``` 
   
   ```java
       public static void main(String[] args) throws Exception{
           Map<String, DataSource> mapDatasource = new HashMap<>();
           HikariDataSource table1Database = new HikariDataSource();
           table1Database.setDriverClassName();
           table1Database.setJdbcUrl();
           table1Database.setUsername();
           table1Database.setPassword();
   
           HikariDataSource table2Database = new HikariDataSource();
           table2Database.setDriverClassName();
           table2Database.setJdbcUrl();
           table2Database.setUsername();
           table2Database.setPassword();
           mapDatasource.put("table1Database",table1Database);
           mapDatasource.put("table2Database",table2Database);
   
           DataSource dataSource = ShardingSphereDataSourceFactory.createDataSource(mapDatasource, null, null);
           Connection connection = dataSource.getConnection();
           connection.prepareStatement("insert into table(id,name,age) values(1,'aaaa',22)").execute();
           connection.close();
       }
   ```
   
   ![image](https://user-images.githubusercontent.com/24687986/229264593-c13e6ee8-fc4a-4f79-8765-a34cb4251bca.png)
   
   
   ```
   I  think  this need configuraiton, but I not found API in RuleConfiration(Interface and implements class )   I do not know  how to 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