Skip to content
Advertisement

Tag: mysql-connector

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

Advertisement