mariadb

SQL statement fails through mysqldb.query in Python

安稳与你 提交于 2019-12-25 16:44:54
问题 I am trying to pass a query through my script, but i get a SQL error. Running the same sql statement in Heidisql works fine. My question is: - What am I doing wrong? error message _mysql.connection.query(self, query) _mysql_exceptions.ProgrammingError: (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 'Gabrielsen)' at line 1") Python script where Database is the correct connection to database F=

java.sql.SQLException: No database selected Exception when connecting via tomcat

不想你离开。 提交于 2019-12-25 16:25:41
问题 I get following Exception: Caused by: java.sql.SQLException: No database selected at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:996) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3887) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3823) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582) at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2530) at com.mysql.jdbc.PreparedStatement

Encoding/Escaping JSON Control Characters

别说谁变了你拦得住时间么 提交于 2019-12-25 09:15:56
问题 I'm using MariaDB's COLUMN_JSON() function. As this bug illustrates, the function properly escapes double quotes, but not other characters that should be encoded/escaped. Here's a silly example query to demonstrate how the JSON column is created. SELECT CONCAT('[', GROUP_CONCAT(COLUMN_JSON(COLUMN_CREATE( 'name', `name`, 'value', `value` )) SEPARATOR ','), ']') AS `json` FROM `settings` If the name or value contain invalid JSON characters, json_decode will fail. I've written a PHP function to

Get the cars that passed specific cameras

大憨熊 提交于 2019-12-25 08:27:12
问题 MYSQL/MARIADB Schema and sample data: CREATE DATABASE IF NOT EXISTS `puzzle` DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_unicode_ci; USE `puzzle`; DROP TABLE IF EXISTS `event`; CREATE TABLE `event` ( `eventId` bigint(20) NOT NULL AUTO_INCREMENT, `sourceId` bigint(20) NOT NULL COMMENT 'think of source as camera', `carNumber` varchar(40) NOT NULL COMMENT 'ex: 5849', `createdOn` datetime DEFAULT NULL, PRIMARY KEY (`eventId`) ) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

MariaDB won't create table with large VARCHAR as PRIMARY KEY

半腔热情 提交于 2019-12-25 08:08:12
问题 I tried to create a table in MariaDB, I wanted it to be VARCHAR(767) and PRIMARY KEY. I used this command but this is not what I want to. CREATE TABLE main(username VARCHAR(767) NOT NULL); This command is executed, but if I add PRIMARY KEY the error will be appeared. CREATE TABLE main(username VARCHAR(767) NOT NULL PRIMARY KEY); ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes 回答1: What version are you using? I've tried your command on my MariaDB (10.1.20-MariaDB),

MySQL Query select fields where time value in table is equal to current time

会有一股神秘感。 提交于 2019-12-25 08:06:20
问题 What I want to do is have a program run every minute. The program uses C code to get the current time and date and then I am trying to get a MySQL query to compare the time in the database field to see if it matches the current time. I only want to use the hour and minute when exctraing the value from MySQL and not the seconds. I can not seem to get the MySQL query to work. Note the %s in the code is for the C program to insert the current time generated by the c code. Here is the MySQL:

mysql errno: 150 “Foreign key constraint is incorrectly formed”- MariaDB

守給你的承諾、 提交于 2019-12-25 08:06:04
问题 MESSAGE_MAP TABLE CREATE TABLE `message_map` ( `message_from` varchar(15) NOT NULL, `message_id` varchar(15) NOT NULL, `message_to` varchar(15) NOT NULL, `message_status` bit(1) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1; ALTER TABLE `message_map` ADD PRIMARY KEY (`message_from`,`message_id`,`message_to`), ADD KEY `FK_ij6tystusydqijqp8lgoigo1c` (`message_id`), USER TABLE CREATE TABLE `user` ( `USER_ID` varchar(15) NOT NULL, `PASSWORD` varchar(15) DEFAULT NULL, `PHONE_NUMBER` varchar

event schedules in maria db

﹥>﹥吖頭↗ 提交于 2019-12-25 07:30:07
问题 The following query has failed: CREATE EVENT `UNUSED` ON SCHEDULE EVERY 1 HOUR STARTS '2016-06-14 11:00:00.000000' ENDS '2016-06-30 01:00:00.000000' ON COMPLETION NOT PRESERVE ENABLE DO UPDATE quotation_details SET status='UNUSED' WHERE updatedTime <= DATE_SUB(NOW(), INTERVAL 10 DAYS) ; MySQL said: #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 'DAYS)' at line 1 回答1: Change DAYS to DAY like

Group by a variable range in mysql / MariaDB

纵饮孤独 提交于 2019-12-25 06:09:08
问题 I have a history log and i want to summarize some entries. The interval should be 5 seconds For example: I have a list date_start | date_end | count | somestring 2015-09-15 12:04:09 | 2015-09-15 12:04:09| 1 | xyz 2015-09-15 12:05:09 | 2015-09-15 12:05:09| 1 | xyz 2015-09-15 12:05:10 | 2015-09-15 12:05:10| 1 | xyz 2015-09-15 12:05:11 | 2015-09-15 12:05:11| 1 | xyz 2015-09-15 12:06:09 | 2015-09-15 12:06:09| 1 | xyz I want now to have an output like date_start | date_end | count | somestring

mysql to mariadb migration

独自空忆成欢 提交于 2019-12-25 05:08:26
问题 We are using mysql 5.5.16 in production servers. Now we are planning either mysql upgrade(5.6/5.7) or migration to mariadb latest version.Please suggest which option is best. If mariadb option is best then Please let me know the steps for migrating mysql 5.5.16 to mariadb latest version ? 来源: https://stackoverflow.com/questions/36051896/mysql-to-mariadb-migration