简体   繁体   中英

Hibernate Error : Unable to resolve connection default schema

I am getting the following error while starting up my application. I am using spring 5.2.2 release and the following dependencies.

I am using MySQL V8

<version.spring>5.2.2.RELEASE</version.spring>
<version.hibernate-core>5.3.10.Final</version.hibernate-core>
<version.hibernate-validator>6.0.16.Final</version.hibernate-validator>
<version.hibernate-entitymanager>5.3.10.Final</version.hibernate-entitymanager>

The stack trace is:

06:42:15.798 [localhost-startStop-1] DEBUG org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator - Database ->
    name : MySQL
  version : 5.6.37
   major : 5
   minor : 6
06:42:15.798 [localhost-startStop-1] DEBUG org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator - Driver ->
    name : MySQL Connector/J
  version : mysql-connector-java-8.0.19 (Revision: a0ca826f5cdf51a98356fdfb1bf251eb042f80bf)
   major : 8
   minor : 0
06:42:15.798 [localhost-startStop-1] DEBUG org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator - JDBC version : 4.2
06:42:15.799 [localhost-startStop-1] INFO org.hibernate.dialect.Dialect - HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
06:42:15.849 [localhost-startStop-1] DEBUG org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver - Unable to use Java 1.7 Connection#getSchema
06:42:15.849 [localhost-startStop-1] DEBUG org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl - Unable to resolve connection default schema
org.hibernate.HibernateException: Use of DefaultSchemaNameResolver requires Dialect to provide the proper SQL statement/command but provided Dialect [org.hibernate.dialect.MySQL5Dialect] did not return anything from Dialect#getCurrentSchemaCommand
    at org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver$SchemaNameResolverFallbackDelegate.resolveSchemaName(DefaultSchemaNameResolver.java:100)
    at org.hibernate.engine.jdbc.env.internal.DefaultSchemaNameResolver.resolveSchemaName(DefaultSchemaNameResolver.java:76)

Looks like your JDBC driver or connection pool implementation might not return a proper value when calling java.sql.Connection#getSchema , but instead throws an exception. You'll have to debug this to understand what is wrong here. The MySQL JDBC driver should be capable to return the current schema if it really is version 8.0.19 that you are using.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM