3) is right
If you're converting the date to a string in your select (using
to_char() SLQ function), stop doing that. Instead, you obtain the date directly using
ResultSet.getDate or
ResutSet.getTimestamp. You don't have to mess with date formats this way. Conversely, when passing dates to the database, you'll use
PreparedStatement.setDate or
PreparedStatement.setTimestamp.
Oracle's JDBC tutorial covers these things nicely.
If you store the dates in the database as
VARCHARs, then you obviously need to do the conversion. You might use to_date SQL function in your select statement, which would let you have a text converted to a date by Oracle itself, which lets you use any text format recognized by Oracle, of course. Then read the date using one of the methods mentioned earlier. Look up to_date and to_char functions in Oracle's documentation.
It's not a good idea to store dates as text in the database. It might lead to lots of implicit conversions, and
you should always
avoid implicit conversions. Besides, it usually makes the queries perform worse than when using DATE for dates.