Error executing DDL via JDBC Statement

Source: Internet
Author: User
Tags mysql version

? Copyright NOTICE: This article is the original blogger article, reproduced please indicate the source

1. Description of the problem:

To start the hibernate test case times are wrong:

Org.hibernate.tool.schema.spi.CommandAcceptanceException:Error executing DDL via JDBC statementat Org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept (generationtargettodatabase.java:67) At Org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString (schemacreatorimpl.java:438) at Org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings (schemacreatorimpl.java:423) at Org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata (schemacreatorimpl.java:314) at Org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation (schemacreatorimpl.java:165) at Org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation (schemacreatorimpl.java:134) at Org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation (schemacreatorimpl.java:120) at Org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction ( schemamanagementtoolcoordinator.java:148) at Org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process (SchemAMANAGEMENTTOOLCOORDINATOR.JAVA:65) at Org.hibernate.internal.sessionfactoryimpl.<init> ( sessionfactoryimpl.java:459) at Org.hibernate.boot.internal.SessionFactoryBuilderImpl.build ( sessionfactorybuilderimpl.java:465) at Org.hibernate.cfg.Configuration.buildSessionFactory (Configuration.java : 711) at Org.hibernate.cfg.Configuration.buildSessionFactory (configuration.java:727) at Org.hibernate.test.StudentTest.before (studenttest.java:32) at Sun.reflect.NativeMethodAccessorImpl.invoke0 ( Native Method) at Sun.reflect.NativeMethodAccessorImpl.invoke (nativemethodaccessorimpl.java:57) at Sun.reflect.DelegatingMethodAccessorImpl.invoke (delegatingmethodaccessorimpl.java:43) at Java.lang.reflect.Method.invoke (method.java:606) at Org.junit.runners.model.frameworkmethod$1.runreflectivecall ( FRAMEWORKMETHOD.JAVA:50) at Org.junit.internal.runners.model.ReflectiveCallable.run (reflectivecallable.java:12) At org.junit.runners.model.FrameworkMethod.invokeExplosively (frameworkmethod.java:47) at Org.junit.internal.runNers.statements.RunBefores.evaluate (runbefores.java:24) at Org.junit.internal.runners.statements.RunAfters.evaluate (runafters.java:27) at Org.junit.runners.ParentRunner.runLeaf (parentrunner.java:325) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:78) at Org.junit.runners.BlockJUnit4ClassRunner.runChild (blockjunit4classrunner.java:57) at Org.junit.runners.parentrunner$3.run (parentrunner.java:290) at Org.junit.runners.parentrunner$1.schedule ( parentrunner.java:71) at Org.junit.runners.ParentRunner.runChildren (parentrunner.java:288) at org.junit.runners.parentrunner.access$000 (parentrunner.java:58) at Org.junit.runners.parentrunner$2.evaluate ( parentrunner.java:268) at Org.junit.runners.ParentRunner.run (parentrunner.java:363) at Org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (junit4testreference.java:86) at Org.eclipse.jdt.internal.junit.runner.TestExecution.run (testexecution.java:38) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (Remotetestrunner.java:459) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests (Remotetestrunner.java : 675) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run (remotetestrunner.java:382) at Org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (remotetestrunner.java:192) caused by: Com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException:You has an error in your SQL syntax; Check the manual-corresponds to your MySQL server version for the right syntax-use-near ' type=innodb ' on line 8at Sun.reflect.NativeConstructorAccessorImpl.newInstance0 (Native Method) at Sun.reflect.NativeConstructorAccessorImpl.newInstance (nativeconstructoraccessorimpl.java:57) at Sun.reflect.DelegatingConstructorAccessorImpl.newInstance (delegatingconstructoraccessorimpl.java:45) at Java.lang.reflect.Constructor.newInstance (constructor.java:526) at Com.mysql.jdbc.Util.handleNewInstance ( util.java:425) at Com.mysql.jdbc.Util.getInstance (util.java:408) at COM.MYSQL.JDBC.SQLERROR.CREATESQLEXCEPtion (sqlerror.java:943) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:3973) at Com.mysql.jdbc.MysqlIO.checkErrorPacket (mysqlio.java:3909) at Com.mysql.jdbc.MysqlIO.sendCommand (Mysqlio.java : 2527) at Com.mysql.jdbc.MysqlIO.sqlQueryDirect (mysqlio.java:2680) at Com.mysql.jdbc.ConnectionImpl.execSQL ( connectionimpl.java:2486) at Com.mysql.jdbc.ConnectionImpl.execSQL (connectionimpl.java:2444) at Com.mysql.jdbc.StatementImpl.executeInternal (statementimpl.java:845) at Com.mysql.jdbc.StatementImpl.execute ( statementimpl.java:745) at Org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept ( generationtargettodatabase.java:54) ... Panax Notoginseng More

2. Solution:

Because hibernate sets the dialect as

Org.hibernate.dialect.MySQLInnoDBDialect

The dialect is built using the "TYPE=INNODB" SQL statement before MySQL5.0, but the MySQL version used is 5.7.17, "Type=innodb" is no longer in effect and becomes "Engine=innodb"

Therefore, you need to set the dialect to

Org.hibernate.dialect.MySQL5InnoDBDialect

Error executing DDL via JDBC Statement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.