play Framework MySQL and EBean - mysql

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.

Related

Mysql error BLOB, TEXT, GEOMETRY or JSON colum cant have default value

My vps linux ubuntu is
Server type: MySQL
Server version: 5.7.33 ubuntu0.18.04.1 - (Ubuntu)
Apache/2.4.29 (Ubuntu)
Database client version: libmysql - mysqlnd 5.0.12-dev - 20150407 -
PHP version: 7.2.24-
Trying to add a column in my database but im getting error
I tried that on windows xampp its work without any problem
ALTER TABLE users ADD COLUMN house LONGTEXT NOT NULL DEFAULT '{"owns":false,"furniture":[],"houseId":0}';
Error
SQL query:
ALTER TABLE users ADD COLUMN house LONGTEXT NOT NULL DEFAULT '{"owns":false,"furniture":[],"houseId":0}'
MySQL said: Documentation
#1101 - BLOB, TEXT, GEOMETRY or JSON column 'house' can't have a default value
I'm going to guess that your local XAMPP development server is running MySQL 8.0.13 or newer — or MariaDB 10.2.1 or newer. Prior to that version, MYSQL did not allow a DEFAULT value other than NULL for JSON columns. In MariaDB, JSON is an alias for LONGTEXT, which likewise (starting with version 10.2.1) allows DEFAULT values.
Probably your development environment allows the defaults and the production environment doesn't. You can either upgrade your production system or not use that feature.
Remove the default value:
ALTER TABLE users ADD COLUMN house LONGTEXT NOT NULL;

SQL Syntax errors in VS Code in local vs remote host

I'm trying to containerize an app so I'm trying to write an init file for a MariaDB database for an existing database that exists on a remote server. I'm using VS Code to connect to the remote server and the .sql file with the contents of the dump has no errors, but when I try and copy it to a different workspace on my local computer, I get many syntax errors.
Examples of the syntax errors:
DROP TABLE IF EXISTS `accounts`;
CREATE TABLE `accounts` (
`table_number` int(11) NOT NULL AUTO_INCREMENT,
`account_id` varchar(12) NOT NULL,
`account_name` varchar(5) NOT NULL,
PRIMARY KEY (`table_number`)
) ENGINE=InnoDB AUTO_INCREMENT=261 DEFAULT CHARSET=latin1;
Incorrect syntax near '`'. Expecting '(', or SELECT.
Incorrect syntax near '11'. Expecting '(', or SELECT.
The error about the ` character is present before "accounts" and before both instances of "table_number" but not before "account_id" and "account_name". Every number in the CREATE has the incorrect syntax warning. I've tried retyping rather than copy and pasting to see if there's hidden characters responsible for these issues, but no luck.
Is this an OS issue? The remote server is a CentOS machine and my local is macOS Catalina. A setting in VS Code I need to specify or change?

Cannot connect MySQL with Liferay in Windows

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.

Error when importing a SQL file using phpMyAdmin

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.

Grails: error in SQL syntax when using MYISAM dialect [duplicate]

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.