org.hibernate.tool.schema.spi.CommandAcceptanceException trying to connect a MYSQL database

Advertisements Im trying to connect a MySQL database to my java springboot project, but i got a org.hibernate.tool.schema.spi.CommandAcceptanceException error, i already tried to change spring.jpa.hibernate.ddl-auto=update to spring.jpa.hibernate.ddl-auto=update, and its still wrong. Error: org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "create table to_do (id integer not null, desc varchar(255), done bit not null, target_date date, username varchar(255), primary key… Read More org.hibernate.tool.schema.spi.CommandAcceptanceException trying to connect a MYSQL database

How to pass the date parameter in pyspark query using Jupyter notebook?

Advertisements I want to pass the date parameter in below query in jupyter notebook but its not working as the way its mentioned below. Dont know where the problem is lying. filedate = ‘2022-11-15’ query = """(select * from db.xyz where name = ‘Tom’ and login = ‘{filedate}’) as salary""" df = spark.read.format("jdbc")\ .option("url", jdbc_url)\… Read More How to pass the date parameter in pyspark query using Jupyter notebook?

Java JDBC MySQL multiple INSERTS in one executeUpdate()

Advertisements I’m using JDBC to make my Java application handle SQL statements to my MySQL database. For some reason it can’t do multiple insert statements in one executeUpdate() method. My code looks like this: PreparedStatement statement = connection().prepareStatement(sql); boolean success = statement.executeUpdate() > 0; if (doClose) closeConnection(); return success; where sql is a string of… Read More Java JDBC MySQL multiple INSERTS in one executeUpdate()

How to check if there is a specific number in the database

Advertisements This is my entire code: import java.sql.*; import java.io.*; public class VerInformacaoPassageiro { public static void main(String args[]) { String dbname = "BD22"; String dbuser = "postgres"; String password = "12345"; String url = "jdbc:postgresql://localhost:5432/" + dbname; try { BufferedReader in; in = new BufferedReader( new InputStreamReader( System.in )); System.out.print("Numero de identificacao: "); String… Read More How to check if there is a specific number in the database

You have an error in your SQL syntax; check the manual that

Advertisements I am getting SQL Syntax Error , i don’t know why? I have checked everything but couldn’t get through this error. I am using eclipse. Here is the code for adding user package com.DOA; import java.sql.Connection; import java.sql.PreparedStatement; import com.User.UserDetails; public class UserDOA { private Connection conn; public UserDOA(Connection conn) { super(); this.conn =… Read More You have an error in your SQL syntax; check the manual that

Can anyone see the mistake in the SQL Command i am using to update a record in a local DB using JDBC?

Advertisements I am trying to update a DB Table at my college using JDBC and JAVAFx. I have tried everything to get the SQL Update command to work. I have a table where the player_id is the foreign key from the table – Player -, and is a child table to its parent namely –… Read More Can anyone see the mistake in the SQL Command i am using to update a record in a local DB using JDBC?

SQL – How to retrieve columns that end with one of characters in a list

Advertisements I’m trying to learn sql and figuring out a way to retrieve all columns whose name ends with one of characters in an a list (using JDBC queries): public Map<Long, Set<Long>> groupCountriesBy(Set<Integer> countryIdLastDigits) { String query = "SELECT c.id FROM countries c" + " WHERE c.name LIKE ‘%[dea]’" + " GROUP BY c.name ";… Read More SQL – How to retrieve columns that end with one of characters in a list

Error: com.microsoft.sqlserver.jdbc.SQLServerException: The index 2 is out of range

Advertisements I have a function to update the user’s information as follows: public void updateAccount(String username, String name, String address, String aboutMe, String id) { String sql = "update Account set username = ‘?’, \n" + " [Full_Name] = ‘?’,\n" + " [Address] = ‘?’,\n" + " [about_me] = ‘?’\n" + " where id =… Read More Error: com.microsoft.sqlserver.jdbc.SQLServerException: The index 2 is out of range