i try withthe snippet of code when i try to format a String to sql date and to insert the date into table of database with one column with name dateep:
when i executed it generate this error :Exception in thread "main" java.sql.SQLDataException: ORA-01861: literal does not match format string
please how can i solve the problem of inserting date into oracle database ofter parsing from string
That's because after parsing the date, you're converting it back to a string again when you concatenate it to your insert statement. The resulting SQL query will look like this:
This apparently isn't what your database expects DATE values to be formatted like.
You shouldn't be manually hacking your queries together anyway. Use a prepared statement. Also, avoid java.util.Date and use the new java.time API instead, before you convert it to java.sql.Date. Finally, don't forget to close your connections.