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 2021/12/20 13:39:07 UTC

[GitHub] [shardingsphere] qianxuwanyu opened a new issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

qianxuwanyu opened a new issue #14177:
URL: https://github.com/apache/shardingsphere/issues/14177


   shardingproxy  Table 'XXX.XXX' doesn't exist


-- 
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] qianxuwanyu edited a comment on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

Posted by GitBox <gi...@apache.org>.
qianxuwanyu edited a comment on issue #14177:
URL: https://github.com/apache/shardingsphere/issues/14177#issuecomment-998497457


   ```
   import org.apache.ddlutils.model.Column;
   import org.apache.ddlutils.model.Table;
   import org.apache.ddlutils.platform.DatabaseMetaDataWrapper; //导入方法依赖的package包/类
   import org.apache.ddlutils.platform.MetaDataColumnDescriptor;
   import org.springframework.jdbc.support.JdbcUtils;
   
     //注册驱动程序 mysql 5+ or 8+
         DriverManager.registerDriver(new com.mysql.jdbc.Driver());
         //获得连接
         String url = "jdbc:mysql://localhost:3307/fintax_tax_proxy?useSSL=false";
         Connection con = DriverManager.getConnection(url, "root", "root");
         //检索元数据对象
         DatabaseMetaData metaData = con.getMetaData();
   
         //it's ok
         ResultSet columnData = metaData.getColumns("fintax_tax_proxy", "fintax_tax_proxy", "config_area", null);
   
         //failed
         ResultSet primaryKeys = metaData.getPrimaryKeys("fintax_tax_proxy", "fintax_tax_proxy", "config_area");
   
   Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'fintax_tax_proxy.config_area' doesn't exist
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   ```
   # 对外数据库名称
   schemaName: fintax_tax_proxy
   # 数据库链接公共参数
   dataSourceCommon:
    username: root
    password: root123456
    connectionTimeoutMilliseconds: 30000
    idleTimeoutMilliseconds: 60000
    maxLifetimeMilliseconds: 1800000
    maxPoolSize: 50
    minPoolSize: 1
    maintenanceIntervalMilliseconds: 30000
   # 数据库地址,这里配置了两个库
   dataSources:
    ds_0:
      url: jdbc:mysql://localhost:5688/fintax_tax_0?serverTimezone=UTC&useSSL=false
    ds_1:
      url: jdbc:mysql://localhost:5688/fintax_tax_1?serverTimezone=UTC&useSSL=false
   # 分片规则
   rules:
   - !SHARDING
    tables:
      # 虚拟表名称,最后登陆 proxy之后,sharding_db库下只有一张表 test(我这里只分了一个表,用于测试)
      data_qy:
        # ds_${0..1} 分库规则,库索引从0到1,一共两个,前缀为:ds_, test,分成3张表,索引从0到2,前缀为:test_
        actualDataNodes: ds_${0..1}.data_qy_${0..7}
        databaseStrategy:
          standard:
            shardingColumn: qy_id
            shardingAlgorithmName: database_inline
        tableStrategy:
          standard:
            # 分片键
            shardingColumn: qy_id
            shardingAlgorithmName: test_inline
        keyGenerateStrategy:
          column: id
          keyGeneratorName: snowflake  #主键生成策略 -- 雪花算法
      data_tax_report:
        # ds_${0..1} 分库规则,库索引从0到1,一共两个,前缀为:ds_, test,分成3张表,索引从0到2,前缀为:test_
        actualDataNodes: ds_${0..1}.data_tax_report_${0..7}
        databaseStrategy:
          standard:
            shardingColumn: qy_id
            shardingAlgorithmName: user_database_inline
        tableStrategy:
          standard:
            # 分片键
            shardingColumn: qy_id
            shardingAlgorithmName: user_inline
        keyGenerateStrategy:
          column: id
          keyGeneratorName: snowflake  #主键生成策略 -- 雪花算法    
   # 默认数据库分片规则
   


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   > could you provide more information, such as version, log, your configuration and steps to reproduce
   
   You can see my reply code


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   -   //注册驱动程序 mysql 5+ or 8+
         DriverManager.registerDriver(new com.mysql.jdbc.Driver());
         //获得连接
         String url = "jdbc:mysql://localhost:3307/fintax_tax_proxy?useSSL=false";
         Connection con = DriverManager.getConnection(url, "root", "root");
         //检索元数据对象
         DatabaseMetaData metaData = con.getMetaData();
   
         //it's ok
         ResultSet columnData = metaData.getColumns("fintax_tax_proxy", "fintax_tax_proxy", "config_area", null);
   
         //failed
         ResultSet primaryKeys = metaData.getPrimaryKeys("fintax_tax_proxy", "fintax_tax_proxy", "config_area");
   
   Exception in thread "main" com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'fintax_tax_proxy.config_area' doesn't exist
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
   	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
   	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
   	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   import org.apache.ddlutils.model.Column;
   import org.apache.ddlutils.model.Table;
   import org.apache.ddlutils.platform.DatabaseMetaDataWrapper; //导入方法依赖的package包/类
   import org.apache.ddlutils.platform.MetaDataColumnDescriptor;
   import org.springframework.jdbc.support.JdbcUtils;
   
   I don't know how to comment


-- 
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 closed issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

Posted by GitBox <gi...@apache.org>.
terrymanu closed issue #14177:
URL: https://github.com/apache/shardingsphere/issues/14177


   


-- 
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] qianxuwanyu removed a comment on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

Posted by GitBox <gi...@apache.org>.
qianxuwanyu removed a comment on issue #14177:
URL: https://github.com/apache/shardingsphere/issues/14177#issuecomment-999314060


   > could you provide more information, such as version, log, your configuration and steps to reproduce
   
   
   
   > which version of proxy did you use, could you provide the proxy yaml configuration?
   apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy-bin  or 4.x all
   


-- 
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] menghaoranss commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   could you provide more information, such as version,  log, your configuration and steps to reproduce
   


-- 
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] qianxuwanyu removed a comment on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

Posted by GitBox <gi...@apache.org>.
qianxuwanyu removed a comment on issue #14177:
URL: https://github.com/apache/shardingsphere/issues/14177#issuecomment-998498802


   import org.apache.ddlutils.model.Column;
   import org.apache.ddlutils.model.Table;
   import org.apache.ddlutils.platform.DatabaseMetaDataWrapper; //导入方法依赖的package包/类
   import org.apache.ddlutils.platform.MetaDataColumnDescriptor;
   import org.springframework.jdbc.support.JdbcUtils;
   
   I don't know how to comment


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   > could you provide more information, such as version, log, your configuration and steps to reproduce
   
   ![Uploading image.png…]()
   


-- 
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 #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   Hi @qianxuwanyu , could you try `metaData.getPrimaryKeys(connection.getCatalog(), connection.getSchema(), tableName)`?
   
   It should work, I've used it on similar scenario. You could refer to [PipelineTableMetaDataLoader.java]( https://github.com/apache/shardingsphere/blob/master/shardingsphere-kernel/shardingsphere-data-pipeline/shardingsphere-data-pipeline-core/src/main/java/org/apache/shardingsphere/data/pipeline/core/metadata/loader/PipelineTableMetaDataLoader.java )
   


-- 
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] menghaoranss commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   which  version of proxy did you use, could you provide the proxy yaml configuration?


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   > could you provide more information, such as version, log, your configuration and steps to reproduce
   
   
   
   > which version of proxy did you use, could you provide the proxy yaml configuration?
   apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy-bin  or 4.x all
   


-- 
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 #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   Closed because of no response


-- 
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] qianxuwanyu commented on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

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


   > which version of proxy did you use, could you provide the proxy yaml configuration?
   
   apache-shardingsphere-5.0.0-alpha-shardingsphere-proxy-bin or 4.x  all cant not be success


-- 
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] qianxuwanyu removed a comment on issue #14177: DatabaseMetaData metaData = con.getMetaData(); metaData.getPrimaryKeys()is failed

Posted by GitBox <gi...@apache.org>.
qianxuwanyu removed a comment on issue #14177:
URL: https://github.com/apache/shardingsphere/issues/14177#issuecomment-998492642


   > could you provide more information, such as version, log, your configuration and steps to reproduce
   
   ![Uploading image.png…]()
   


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