想问一个问题,SS JDBC在新版本中能够通过information_schema.tables访问到逻辑表的元数据信息吗?

比如这种方式

@Test
    public void tableExistSQL() throws SQLException, IOException {
        String filePath = MetaTest.class.getResource("/sharding.yaml").getFile();
        DataSource dataSource = YamlShardingDataSourceFactory.createDataSource(new File(filePath));

        Connection connection = dataSource.getConnection();

        String sql = "SELECT COUNT(*) " +
                "FROM information_schema.TABLES " +
                "WHERE TABLE_NAME = 't_order' ;";
        PreparedStatement preparedStatement = connection.prepareStatement(sql);
        ResultSet resultSet = preparedStatement.executeQuery();
        while (resultSet.next()){
            LOG.info("表数量:{}",resultSet.getInt(1));
        }

        preparedStatement.close();
        connection.close();
    }
京ICP备2021015875号