Inserting records into database
Hi,
I am new to database connectivity using servlets. I have a form which on clicked should insert data into database. I am able to get the data from the fields as follows:
String HLDY_CODE = req.getParameter("HOLIDAY_CODE").trim();
String HLDY_DESCR = req.getParameter("HOLIDAY_DESCR").trim();
String HLDY_DATE = req.getParameter("HOLIDAY_DATE").trim();
String USERID = req.getParameter("LST_CHANGE_USERID").trim();
I am trying to insert these into the database. I tried the following way but its not working.
String sql = "INSERT into hldy(HLDY_CODE, HLIDY_DESCR";
sql += ", HLIDY_DATE, USERID, TIME_STAMP) values (?, ?, ?, ?, ?)";
ps= conn.prepareStatement(sql);
stmt = conn.createStatement();
//inserting records
ps.setString(1, HOLIDAY_CODE);
ps.setString(2, HOLIDAY_DESCR);
ps.setString(3, HOLIDAY_DATE);
ps.setString(4, LAST_CHANGE_USERID);
I also need to insert the time stamp when the record is being inserted. The fields of "hldy" table are HLDY_CODE, HLDY_DESCR, HLDY_DATE, USERID, TIME_STAMP. How can I find the time the record is being inserted? Can someone point me in the right direction please.
Thanks
Chak

