While I agree with Paul, of course...
Paul Clapham wrote:I would suggest you rewrite your code to use a PreparedStatement. [...]
... your current problem can be solved by writing
The above date literal syntax is specified by the SQL standard. It accepts the following format:
DATE 'YYYY-MM-DD', which is what happens to be produced by
java.sql.Date.toString().
In case you're using the Derby database, use this instead:
In case you're using a T-SQL database (SQL Server, Sybase ASE, Sybase SQL Anywhere) or SQLite, just use the plain date
string as such:
But again, it would really be better to follow Paul's advice and use a PreparedStatement with bind values instead.