This question already has an answer here:
Closed 10 years ago.
Possible Duplicate:
Grails: error in SQL syntax when changing the hibernate dialect
I am using Grails with mySQL database and I am trying to change the database engine. As far as I researched this can be done best with
dialect = "org.hibernate.dialect.[MyDialect]"
in the DataSource.groovy config. But when I set the dialect to org.hibernate.dialect.MySQLMyISAMDialect creation of my table fails with error:
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use
near 'type=MyISAM' at line 1
I also tried to alter the table later with:
sql.execute("ALTER TABLE book ENGINE = MYISAM;")
and this actually works but all the foreign keys are dropped for the table when changing the engine after the creation.
How should I avoid the error and change the engine normally?
pav,
I am running MySQL 5.5.25, Grails 2.1.0, and grails hibernate-2.1.0 plugin, which uses hibernate-core 3.6.10.FINAL under the covers.
This may be an issue with your version of Grails (well, more specifically the underlying version of Hibernate that Grails is using) and your version of MySQL.
Here is a bug reported on Hibernate JIRA: HHH-5988.
I am using InnoDB as my engine, and I tried swapping in MyISAM as follows in my DataSource.groovy:
dataSource {
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
// dialect = "org.hibernate.dialect.MySQL5InnoDBDialect"
dialect = "org.hibernate.dialect.MySQLMyISAMDialect"
username = "study"
password = "********"
}
and I got errors upon table creation as well.
Here is a sample of one of the errors I get, which corresponds to the bug reported on Hibernate JIRA:
| Error 2012-08-22 13:15:12,739 [pool-4-thread-1] ERROR hbm2ddl.SchemaExport
- Unsuccessful: create table user (id bigint not null auto_increment,
version bigint not null,
login varchar(255) not null unique,
password varchar(255) not null,
role varchar(5) not null,
primary key (id)) type=MyISAM
One of the comments on the aforementioned Hibernate JIRA bug is a user who is creating his own custom dialect for MySQL 5 MyISAM.
Related
I launched my app with JPA and it suppose to create me some tables.
The problem is that Hibernate added some extra SQL code ('type=MyISAM').
org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table person (id integer not null auto_increment, name varchar(255), uuid binary(255), primary key (id)) type=MyISAM" via JDBC Statement
Caused by: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=MyISAM' at line 1
I have any idea what is 'type=MyISAM' that hibernate added to SQL queries...
Anybody here know what is it about ?
it is a DB dialect problem.
if you are using mysql database then you please add below property key in your application.properties file:--
spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect
... and for MySQL 8
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect
I have created MySQL database using create database dblife character set utf8. I have using MySQL version 8.0.11 and MySQL-connector version 5.1.4. After downloading MySQL-connector, I have replaced .jar file with the Mysql.jar inside lib/ext directory. So, When I run the Liferay server version 6.2, It gives me following error shown below.
Error I am getting on eclipse console:
09:51:13,420 INFO [localhost-startStop-1][DialectDetector:71] Determine dialect for MySQL 8
09:51:13,445 INFO [localhost-startStop-1][DialectDetector:136] Found dialect org.hibernate.dialect.MySQLDialect
09:40:37,209 INFO [http-bio-8080-exec-2][StartupAction:97] There are no patches installed
09:40:37,216 ERROR [http-bio-8080-exec-2][JDBCExceptionReporter:82] Table 'dblife.lock_' doesn't exist
09:40:37,221 WARN [http-bio-8080-exec-2][StartupAction:147] Unable to clear locks because Lock table does not exist
09:40:37,223 WARN [http-bio-8080-exec-2][ReleaseLocalServiceImpl:171] Table 'dblife.release_' doesn't exist
09:40:37,226 INFO [http-bio-8080-exec-2][ReleaseLocalServiceImpl:84] Create tables and populate with default data
09:40:38,058 WARN [http-bio-8080-exec-2][BaseDB:457] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system tinyint, maxUsers integer, active_ tinyint) engine InnoDB' at line 1: create table Company ( companyId bigint not null primary key, accountId bigint, webId varchar(75) null, key_ longtext null, mx varchar(75) null, homeURL longtext null, logoId bigint, system tinyint, maxUsers integer, active_ tinyint) engine InnoDB;_ [Sanitized]
09:40:47,056 WARN [http-bio-8080-exec-2][BaseDB:457] Table 'dblife.company' doesn't exist: create index IX_38EFE3FD on Company (logoId);_ [Sanitized]
09:40:47,058 WARN [http-bio-8080-exec-2][BaseDB:457] Table 'dblife.company' doesn't exist: create index IX_12566EC2 on Company (mx);_ [Sanitized]
09:40:47,059 WARN [http-bio-8080-exec-2][BaseDB:457] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'system)' at line 1: create index IX_35E3E7C6 on Company (system);_ [Sanitized]
09:40:47,060 WARN [http-bio-8080-exec-2][BaseDB:457] Table 'dblife.company' doesn't exist: create unique index IX_EC00543C on Company (webId);_ [Sanitized]
09:40:58,636 WARN [http-bio-8080-exec-2][BaseDB:457] Specified key was too long; max key length is 3072 bytes: create index IX_7020130F on SCProductVersion (directDownloadURL);_ [Sanitized]
09:40:58,637 ERROR [http-bio-8080-exec-2][BaseDB:464] create index IX_7020130F on SCProductVersion (directDownloadURL);
09:41:01,417 WARN [http-bio-8080-exec-2][BaseDB:457] Specified key was too long; max key length is 3072 bytes: create index IX_89509087 on User_ (companyId, openId);_ [Sanitized]
09:41:01,418 ERROR [http-bio-8080-exec-2][BaseDB:464] create index IX_89509087 on User_ (companyId, openId);
09:41:03,401 INFO [http-bio-8080-exec-2][BaseDB:484] Database does not support case sensitive queries
09:41:04,169 INFO [http-bio-8080-exec-2][VerifyProcess:65] Verifying com.liferay.portal.verify.VerifyProcessSuite
09:41:04,170 INFO [http-bio-8080-exec-2][VerifyProcess:65] Verifying com.liferay.portal.verify.VerifyProperties
09:41:04,195 ERROR [http-bio-8080-exec-2][DBUpgrader:247] Unable to execute verify process: com.liferay.portal.verify.VerifyException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dblife.company' doesn't exist
com.liferay.portal.verify.VerifyException: com.liferay.portal.verify.VerifyException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dblife.company' doesn't exist
Caused by: com.liferay.portal.verify.VerifyException: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dblife.company' doesn't exist
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'dblife.company' doesn't exist
Furthermore, I am unable to add portal-ext.properties inside liferay.home directory. When I add this portal-ext.properties file, then I get Error: Liferay v6.2(tomcat7 at localhost has encountered a problem.
I have checked existing solution liferay-not-working-with-mysql, but I cannot see Database Migration options inside Control Panel > Administration Tools
Could anyone please suggest me solution. I will be very thankful to you.
When you install Liferay, it requires CREATE TABLE and other DDL permissions on the database. Make sure that you grant those to the user you're running Liferay as. You can revoke them, once the tables are created - after installation Liferay only needs the standard CRUD operations (until you upgrade or deploy new components that require such permissions).
Also, Liferay 6.2 predates mysql 8 by a few years - it's safe to assume that both have never been tested together, and I'd recommend to go with a database that's been tested with it, rather than trying to make work what nobody has ever tried before. You'll find the enterprise-supported versions in the compatibility matrix.
I am not proficient in MySQL and phpMyAdmin and got this error when trying to import my SQL file to a new installation of WAMP. I was developing a joomla website on my local pc and after completion, decided to launch it online with Rochen web hosting. When importing this into my Cpanel, it gave me the error below.
Error
Static analysis:
errors were found during analysis.
A closing bracket was expected. (near ")" at position 276)
SQL query:
Database: kwadi.
Table structure for table iq2rf_assets:
CREATE TABLE `iq2rf_assets`
(
`id` int(10) UNSIGNED NOT NULL COMMENT 'Primary Key',
`parent_id` int(11) NOT NULL DEFAULT '0'COMMENT
)
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near ')' at line 14
I tried to resolve with their support but their advice was for me to upgrade my WAMP Server on my local pc to the one that has MariaDB in it and try extract. Now after installing the new WAMP server i am faced with the same issue when trying to import my back up db using phpmyadmin.
It is giving me the same error. I do not know what to do.
Need assistance.
CREATE TABLE iq2rf_assets ( id int(10) UNSIGNED NOT NULL COMMENT 'Primary Key', parent_id int(11) NOT NULL DEFAULT '0')
You do not have a comment on the second field (parent_id), yet you are using the keyword "COMMENT" only to be closing the query after that. Remove it and you're good to go
The assets table has more fields than the 2 fields shown in your post.
This is the reason for the failed import, check your export.
I am trying to duplicate one of my databases on a remote bluehost server in order to setup a dev and stage environment for my drupal website. Dev is already setup/populated and working fine, so I am now simply trying to duplicate the dev database. Using phpmyadmin on windows (PHP 5.2.17, MySQL 5.5.42). I have done the following steps:
created site_stage database
exported/dumped all tables from site_dev db into compressed sql.gz file
imported all tables into site_stage db
Import fails with $1064 error:
INSERT INTO `cache_bootstrap` (`cid`, `data`, `expire`, `created`, `serialized`, `tags`, `checksum`) VALUES
('system_list', 0x613a323a7b733a353a227468656d65223b613a31333a7b733a363a2262617274696b223b433a33313a2244727570616c5c436f72655c457874656e73696f6e5c457874656e73696f6e223a323339343a7b613a31363a7b733a343a2274797065223b733a353a227468656d65223b733a383a22706174686e616d65223b733a33343a22636f72652f7468656d65732f62617274696b2f62617274696b2e696e666f2e796d6c223b733a383a2266696c656e616d65223b733a31323a2262617274696b2e7468656d65223b733a373a2273756270617468223b733a31333a227468656d65732f62617274696b223b733a363a226f726967696e223b733a343a22636f7265223b733a363a22737461747573223b693a313b733a343a22696e666f223b613a31393a7b733a343a226e616d65223b733a363a2242617274696b223b733a343a2274797065223b733a353a227468656d65223b733a31303a2262617365207468656d65223b733a363a22636c61737379223b733a31313a226465736372697074696f6e223b733a38363a224120666c657869626c652c207265636f6c6f7261626c65207468656d652077697468206d616e79[...]
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '?' at line 2
Thought maybe it didn't like the length of that value, so I just deleted that cache_bootstrap query from uncompressed version of dump file (shouldn't need this cache table anyways) and tried to import again, this time, it failed with the following error:
CREATE TABLE IF NOT EXISTS `key_value` (
`collection` varchar(128) CHARACTER SET ascii NOT NULL DEFAULT '' COMMENT 'A named collection of key and value pairs.'
`value` longblob NOT NULL COMMENT 'The value.',
PRIMARY KEY (`collection`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='Generic key-value storage table. See the state system for…';
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`value` longblob NOT NULL COMMENT 'The value.',
PRIMARY KEY (`collection`,`nam' at line 9
I've read a lot of '1064 error on import' threads, but none of them help and most of them pertain to moving sql data between servers. Very strange that I would get syntax errors copying tables from one database to another on same server, with same mysql version, etc. Any ideas? Thanks in adv.
So I am trying to deploy my play Framework 2.3.5 on my Server. I have connected it with the MySQL database (newest version) and use EBean for persistence.
My 1.sql script looks like:
# --- Created by Ebean DDL
# To stop Ebean DDL generation, remove this comment and start using Evolutions
# --- !Ups
create table input (
id varchar(255) not null auto_increment,
text TEXT not null,
mode varchar(255) not null,
theme varchar(255) not null,
title varchar(255) not null,
PRIMARY KEY (id)
)
;
# --- !Downs
drop table input;
and for the reason i post this my error message:
[info] play - database [default] connected at jdbc:mysql://localhost/pastedemo
[error] play - You have an error in your SQL syntax; check the manual that corresponds to your
MySQL server version for the right syntax to use near 'sequence input_seq' at line 1 [ERROR:1064, SQLSTATE:42000]
Oops, cannot start the server.
#6kaijj99g: Database 'default' is in an inconsistent state!
Can someone tell me where my fault is? :)
Ok I solved the problem. It is pretty easy.
When you want to use your application in production mode, you have to delete the 1.sql. Then use activator dist for packing your application and upload it on your server. Don't test it with run again. After that you can deploy it and it works.