Monday 18 June 2018

Cannot cast java.util.date to java.sql.date

I have the following code snippet where i get continous error for casting java.util.date to java.sql.date.



        SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");

storedProcedureCall.setLong(1, 12345);

storedProcedureCall.setDate(2, (java.sql.Date) sdf.parse("09/02/2017"));
storedProcedureCall.setDate(3, (java.sql.Date) sdf.parse("10/02/2017"));


What am i doing wrong here. I have imported the java.util.Date package as well.

No comments:

Post a Comment

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...