With PreparedStatement, you just call SetDate and be done with it.
How do you pass in a Date with a regular Statement?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It depends on the DBMS you are using, each one can use a different format for date literals.
For example in Oracle, you use:
In MySQL:
Etc.
I would recommend to continue using
PreparedStatementto avoid SQL Injection attacks.