This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
A few suggestions:
1. In the code, print the query string and try running that from mysql. If you don't realize the error from doing that:
2. Post the query string
3. Post the error you are getting
4. Post the database table format
5. A guess: strings need to be wrapped in quotes. Numbers do not
I meant adding System.out.println(query) and post the results of that statement. What were the results of my first suggestion? Also, please post the full error that points at the offending line of code.