Skip to content
Advertisement

Tag: mysql

What is the correct SQLException / spring data exception for missing permissions

I just noticed that when you try to execute a query that does not have required permissions (only tested on a mysql 5.7 database using the mysql-connector-java v8 driver) it is translated to a org.springframework.jdbc.BadSqlGrammarException. This is because the mysql driver itself throws a java.sql.SQLSyntaxErrorException. For instance: java.sql.SQLSyntaxErrorException: INSERT command denied to user ‘myuser’@’127.0.0.1’ for table ‘mytable’ Is this correct

Communication link failure in mysql jdbc driver

I’am not able to establish connection with mysql from java using this code It’s throwing me this error The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. The driver has not received any packets from the server. No appropriate protocol (protocol is disabled or cipher suites are

Non-Redundant Hibernate List-Mapping (OneToMany)

In a database there are “pastries”. A pastry has zero, one, or many allergens. Hence I’m using a list in Pastry with @OneToMany relation. Now, with this way of managing the relations, we get redundant entries, as for each pastry a new entry with the same allergen is created: Our current solution looks like this: A mapping-table in between those

Update query not working in preparedStatements Java

I am writing this program in which I am using preparedStatements to make changes to an SQL Database. However, the UPDATE query is not working. Here is the code: The problem is that no error is being thrown, that is, the output is always Successfully Updated. However, the changes are not being reflected on the database. I have tried executing

Spring Find by unique properties

Given 1 relational table Doctor_ID Client_ID 2 2 2 3 2 4 3 5 4 2 4 3 And I want all the occurrences where client_id is not equals to 3, ignoring the same doctor_id. In this example, I would only get the 4th row… Doctor_ID Client_ID 3 5 How could I achieve something like that? Answer This query with

Problem in running application with Vaadin and Spring (MySQL DB)

I am trying to connect a Vaadin project to a MySQL database following the instructions I found here: https://dzone.com/articles/how-to-connect-a-mysql-database-to-a-vaadin-applic I downloaded the ready project in the article (also available here: https://github.com/Liskokuningas/databasemysqlexample) I, then, created the dummy data schema in MySQL Workbench and tried to run the application via the Windows 10 Command line like this: mvn clean install -U /*all

K8s Spring Application cannot connect to Mysql DB

I wanted to try and deploy my spring boot application on kubernetes. I setted up a test environment with microk8s (dns,storage,ingress enabled) which consists of a pod running the application itself and a pod with the MySQL database. Each pod has its own service and is running on the same default namespace. The yaml files can be seen bellow: Application

Java.net.ConnectException: Connection refused on Docker + Keycloak

I’m new to Docker and I’m having a hard time connecting Keycloak to my local MySQL database. Does anyone have a hint of what’s going on? This is my Dockerfile: The error log shows: Steps already taken: Disabled Firewall; Added bind-address: 0.0.0.0 to my my.cnf file; root@% already has all privileges; Tries setting DB_ADDR and DB_VENDOR in all possible configurations;

Advertisement