Uncaught PDOException: Syntax error or access violation: You have an error in your SQL syntax

Advertisements I’m struggling trying to query a database inside of a PHP class. I’m getting an error when trying to echo out the email address. I’m new to classes and can’t seem to get this to work but if I do a normal PHP function, it works fine. // using composer autoload.php $user = new… Read More Uncaught PDOException: Syntax error or access violation: You have an error in your SQL syntax

Java, JDBC INSERT ON DUPLICATE KEY UPDATE wild cards

Advertisements I Have a next SQL Query: const val INSERT_OR_UPDATE_ITEM_SQL = "" + "INSERT INTO `items` (owner_id, object_id, item_id, count, enchant_level, item_location, item_location_data, custom_type1, custom_type2, duration_left, create_time)" + "VALUES (?,?,?,?,?,?,?,?,?,?,?) " + "ON DUPLICATE KEY UPDATE owner_id=?,object_id=?,item_id=?,count=?,enchant_level=?,item_location=?,item_location_data=?,custom_type1=?,custom_type2=?,duration_left=?,create_time=?" And this is preparation of PreparedStatement: statement.setString(1, item.ownerId) statement.setInt(2, item.objectId) statement.setInt(3, item.template.id) statement.setInt(4, item.count) statement.setInt(5, item.enchantLevel) statement.setString(6, item.itemLocation.name)… Read More Java, JDBC INSERT ON DUPLICATE KEY UPDATE wild cards

spring boot application is running but its docker image cant connect to maria DB which is installed localy

Advertisements I have created a docker image for my spring boot application but i am not able to get that to run. Kindly help me figure this out java.sql.SQLNonTransientConnectionException: Socket fail to connect to host:address=(host=localhost)(port=3306)(type=primary). Connection refused . . 2023-04-25T13:04:41.969Z WARN 1 — [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata… Read More spring boot application is running but its docker image cant connect to maria DB which is installed localy

Docker container does now create table on run, MariaDB

Advertisements I not sure what im doing wrong here but my docker container mariadb does not create a table when it start. what am i doing wrong? docker-compose.yml version: ‘3’ services: db: build: . ports: – "3306:3306" environment: MYSQL_DATABASE: checkitDB MYSQL_USER: myuser MYSQL_PASSWORD: mypassword MYSQL_ROOT_PASSWORD: rootpassword volumes: – ./initDB:/docker-entrypoint-initdb.d initDB.sql CREATE TABLE checkitDB.tasks ( id… Read More Docker container does now create table on run, MariaDB

SQL delete with exists is not working in MariaDB

Advertisements I’m running this select in MariaDB and it works as expected, it’s just a select with an exists: select * from pred_loan_defaults d where exists (select 1 from pred_loan_defaults d2 where d.exec_id = d2.exec_id and d.loan_identifier = d2.loan_identifier and d2.default_status = 1 and d.prediction_date > d2.prediction_date) order by loan_identifier, prediction_date Now, I’m trying to… Read More SQL delete with exists is not working in MariaDB