How to insert Current time in TIMESTAMP column(Oracle) from java class using jdbc

jdbc, oracle, timestamp

Solution

Use a `PreparedStatement` with a parameter for the timestamp, e.g.

UPDATE SUPPORTSTAFF SET SUPPSTAFFJOINDATE = ? where JDBCUSERID = ?

and then set the parameters:

statement.setTimestamp(1, new Timestamp(System.currentTimeMillis()));
statement.setString(2, "your ID");

(Then execute the statement, obviously.)

Problem

i have tryed many things but not able to insert data in my timestamp column. from toad its possible using this ``` UPDATE SUPPORTSTAFF SET SUPPSTAFFJOINDATE=to_timestamp('27/02/2002 15:51.12.539880', 'dd/mm/yyyy hh24:mi.ss.ff') where JDBCUSERID='5700'; ``` its working but how can i insert data from java class using create statment and execute query its giving me invalid month error

Original source