Should JDBC executeBatch() return an array with a length of the original batch even if there were no updates?

I have a simple Java 8 project to update a SQL Server DB table starting by a list of DTO I created. The DTO obviously reflect the column of the table I want to update, suppose it’s similar to the follows: public class TableToUpdate { private int id; private String name; // getter and setter… Read More Should JDBC executeBatch() return an array with a length of the original batch even if there were no updates?

Java SQL Prepared Statement Update not working

Hello I have the problem that I just can’t get the following code to run. I’ve tried and changed all of them but I always get an error, maybe you have an idea where the error is? public class TestCommand implements ServerCommand{ @Override public void performcommand(SlashCommandInteractionEvent event, Member m, MessageChannelUnion channel, VoiceChannel ec, VoiceChannel pub,… Read More Java SQL Prepared Statement Update not working

Why can't I get results from my Inner Join JDBC Query?

This JDBC query does not return anything despite it working on my SQLite Database Browser, no matter what I tried. The snippet is pretty self-explanatory of the results I’m looking for. public void getCountryIdLocationIdDepartmentIdParEmploye(Employe employe) { String query = "SELECT countries.country_id AS idc, locations.location_id AS idl, departments.department_id AS idd FROM countries INNER JOIN locations ON… Read More Why can't I get results from my Inner Join JDBC Query?

Prepared statement – with SET of run-time configuration parameters – not working

Using PG14, Hikari pool, Kotlin 1.6 I get the following error when calling, for example, a SET query: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1" val input = "yes" connection.prepareStatement("SET log_connections TO ?") .apply { setString(1, input) }.use { it.execute() } Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "$1" Position: 22 at… Read More Prepared statement – with SET of run-time configuration parameters – not working

Why does Python's sqlite3 module not respect the order of positional parameters?

Recently I ran across the following peculiar behavior, that can be explained by the following code sample: import sqlite3, platform insert = (10, "today") db = sqlite3.connect(":memory:") db.execute("CREATE TABLE t (number, string)") db.execute("INSERT INTO t (string, number) VALUES ($2, $1)", insert) select = db.execute("SELECT number, string FROM t").fetchone() print(f"python version: {platform.python_version()}") print(f"sqlite version: {sqlite3.sqlite_version}, module:… Read More Why does Python's sqlite3 module not respect the order of positional parameters?

Uncaught ValueError: mysqli_stmt::execute(): Argument #1 ($params) must be a list array

I’m trying to insert prepared statemant multiple values in my database through these two queries, which are both malfunctioning, returning either Uncaught Error: Call to undefined method mysqli_stmt::bindValue() for the first code or Uncaught ValueError: mysqli_stmt::execute(): Argument #1 ($params) must be a list array for second one. When I type list instead of array, it… Read More Uncaught ValueError: mysqli_stmt::execute(): Argument #1 ($params) must be a list array