gs-relational-data-access icon indicating copy to clipboard operation
gs-relational-data-access copied to clipboard

RelationalDataAccessApplication has org.springframework.jdbc.BadSqlGrammarException

Open r00t4dm opened this issue 4 years ago • 6 comments

https://github.com/spring-guides/gs-relational-data-access/blob/adcc29334279b01b9e9d9bafcfb1f8fe61e625c1/complete/src/main/java/com/example/relationaldataaccess/RelationalDataAccessApplication.java#L32

Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [DROP TABLE customers if exists ]; nested exception is java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'if exists' at line 1

please change Sql spell to "jdbcTemplate.execute("DROP TABLE IF EXISTS customers");"

r00t4dm avatar Dec 28 '20 07:12 r00t4dm

This easy fix is a good issue for a new contributor to fix, so I'm adding the good first issue label.

Buzzardo avatar Oct 09 '23 19:10 Buzzardo

hello I tried to submit a PR for this fix but failed

43v3rn88b avatar Jan 26 '24 06:01 43v3rn88b

How did it fail? What messages did you get and from what tools?

Buzzardo avatar Jan 26 '24 15:01 Buzzardo

I'm using intelliJ it says this: Can't create a new pull request: Push failed: remote: Permission to spring-guides/gs-relational-data-access.git denied to 43v3rn88b. unable to access 'https://github.com/spring-guides/gs-relational-data-access.git/': The requested URL returned error: 403

43v3rn88b avatar Jan 27 '24 06:01 43v3rn88b

Other than trying again, I have no idea what to tell you. I do my git work from the command line. You could try that.

Buzzardo avatar Jan 29 '24 18:01 Buzzardo

I submitted a PR

43v3rn88b avatar Jan 30 '24 02:01 43v3rn88b