JiekerTime opened a new issue #11757:
URL: https://github.com/apache/shardingsphere/issues/11757


   ### Which version of ShardingSphere did you use?
   5.0.0-RC1-SNAPSHOT
   
   ### Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?
   ShardingSphere-Proxy
   
   ### Expected behavior
   
![image](https://user-images.githubusercontent.com/76552510/128972346-9df127d2-2cb8-4d0e-ba3f-4298e85aaec4.png)
   
   ### Actual behavior
   Prints out the meta information of all forms in the database:
   
![image](https://user-images.githubusercontent.com/76552510/128972373-f20d81a2-6cd4-4b79-b3a5-d6b4f921485c.png)
   
   ### Steps to reproduce the behavior, such as: SQL to execute, sharding rule 
configuration, when exception occur etc.
   Create the test code as follows.:
   ```
   public class MetaDataTest {
   
       private DataSource createDataSource() {
           HikariConfig result = new HikariConfig();
           result.setDriverClassName("com.mysql.jdbc.Driver");
           
result.setJdbcUrl("jdbc:mysql://localhost:3307/db?useServerPrepStmts=true&serverTimezone=UTC&useSSL=false&useLocalSessionState=true&characterEncoding=utf-8");
           result.setUsername("root");
           result.setPassword("root");
           result.setMaximumPoolSize(2);
           result.setTransactionIsolation("TRANSACTION_READ_COMMITTED");
           result.setConnectionInitSql("SET sql_mode=(SELECT 
REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''))");
           return new HikariDataSource(result);
       }
   
       @Test
       public void metadataTest() {
           List<DataSetColumn> result = new LinkedList<>();
           try (Connection connection = createDataSource().getConnection()) {
               DatabaseMetaData metaData = connection.getMetaData();
               try (ResultSet resultSet = metaData.getColumns(null, null, 
"t_order", null)) {
                   while (resultSet.next()) {
                       DataSetColumn each = new DataSetColumn();
                       System.out.println("COLUMN_NAME: " + 
resultSet.getString("COLUMN_NAME"));
                       each.setName(resultSet.getString("COLUMN_NAME"));
                       System.out.println("TYPE_NAME: " + 
resultSet.getString("TYPE_NAME").toLowerCase());
                       
each.setType(resultSet.getString("TYPE_NAME").toLowerCase());
                       result.add(each);
                       System.out.println("--------");
                   }
               }
           } catch (SQLException e) {
               e.printStackTrace();
           }
           System.out.println(result);
       }
   }
   ```
   


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