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

   ## Bug Report
   
   **For English only**, other languages will not accept.
   
   Before report a bug, make sure you have:
   
   - Searched open and closed [GitHub 
issues](https://github.com/apache/shardingsphere/issues).
   - Read documentation: [ShardingSphere 
Doc](https://shardingsphere.apache.org/document/current/en/overview).
   
   Please pay attention on issues you submitted, because we maybe need more 
details. 
   If no response anymore and we cannot reproduce it on current information, we 
will **close it**.
   
   Please answer these questions before submitting your issue. Thanks!
   
   ### version of ShardingSphere
   5.3.0
   
   ### project used
   ShardingSphere-JDBC
   
   ### Actual behavior
   When I use Hibernate 5.6.x and ShardingSphere together, and set 
"autohbm2ddl.auto: update" to enable Hibernate update database tables 
automatically, it always throws Exception: Object 'information_schema' not 
found, the stack trace like:
   
   ```
   Caused by: java.sql.SQLException: Unknown exception: At line 0, column 0: 
Object 'information_schema' not found
        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.executeQuery(ShardingSpherePreparedStatement.java:247)
        at 
org.hibernate.tool.schema.extract.spi.ExtractionContext.getQueryResults(ExtractionContext.java:49)
        at 
org.hibernate.tool.schema.extract.internal.SequenceInformationExtractorLegacyImpl.extractMetadata(SequenceInformationExtractorLegacyImpl.java:39)
        at 
org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.initializeSequences(DatabaseInformationImpl.java:66)
        at 
org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.<init>(DatabaseInformationImpl.java:60)
        at 
org.hibernate.tool.schema.internal.Helper.buildDatabaseInformation(Helper.java:183)
        ... 93 common frames omitted
   Caused by: org.apache.calcite.runtime.CalciteContextException: At line 0, 
column 0: Object 'information_schema' not found
        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)
        at 
org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
        at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:932)
        at org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:917)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:5362)
        at 
org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:183)
        at 
org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:188)
        at 
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1107)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1078)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3381)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3360)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3697)
        at 
org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:64)
        at 
org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:89)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1107)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:1078)
        at org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:248)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:1053)
        at 
org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:759)
        at 
org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:592)
        at 
org.apache.shardingsphere.sqlfederation.optimizer.SQLOptimizeEngine.optimize(SQLOptimizeEngine.java:50)
        at 
org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.execute(AdvancedSQLFederationExecutor.java:151)
        at 
org.apache.shardingsphere.sqlfederation.advanced.AdvancedSQLFederationExecutor.executeQuery(AdvancedSQLFederationExecutor.java:119)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeFederationQuery(ShardingSpherePreparedStatement.java:312)
        at 
org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.executeQuery(ShardingSpherePreparedStatement.java:234)
        ... 98 common frames omitted
   Caused by: org.apache.calcite.sql.validate.SqlValidatorException: Object 
'information_schema' not found
        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)
        at 
org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:505)
        at org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:599)
        ... 122 common frames omitted
   ```
   
   And when I use Hibernate only, it works well.
   
   ### Configuration
   
   the ShardingSphere configuration:
   
   ```
   dataSources:
     main:
       dataSourceClassName: com.zaxxer.hikari.HikariDataSource
       driverClassName: org.postgresql.Driver
       jdbcUrl: 
jdbc:postgresql://localhost:5432/sparrow_webapi?currentSchema=public
       username: postgres
       password: postgres
       maxPoolSize: 16
   ```
   
   the Hibernate configuration:
   
   ```
   spring:
     datasource:
       main:
         config: shardingsphere.yml
         type: com.zaxxer.hikari.HikariDataSource
         driver-class-name: org.postgresql.Driver
         jdbc-url: jdbc:postgresql://localhost:5432/sparrow_webapi
         username: postgres
         password: postgres
         maximum-pool-size: 2
         properties:
           hibernate:
             allow_update_outside_transaction: true
             cache:
               use_query_cache: false
               use_second_level_cache: false
             default_schema: public
             dialect: org.hibernate.dialect.PostgreSQL10Dialect
             hbm2ddl:
               auto: update
             show_sql: true
   ```


-- 
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-unsubscr...@shardingsphere.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to