01.
public
void
insert(String id,String message)
throws
Exception {
02.
03.
Calendar c = Calendar.getInstance();
04.
SimpleDateFormat df =
new
SimpleDateFormat(
"dd/MM/yyy"
);
05.
String currentDate = df.format(c.getTime());
06.
07.
08.
String insertLogs =
"INSERT INTO APPMOBILE_LOG (ID,DATETIME,MESSAGE) VALUES ("
+id+
",TO_DATE('"
+currentDate+
"', 'dd/MM/yyyy'),'"
+message+
"')"
;
09.
Connection conn =
null
;
10.
PreparedStatement ps =
null
;
11.
try
{
12.
ConnectionUtil utils =
new
ConnectionUtil();
13.
conn = utils.getConnection(conn);
14.
ps = conn.prepareStatement(insertLogs);
15.
ps.executeUpdate();
16.
}
catch
(Exception e) {
17.
log.error(String.format(
"Add Logs Error Database : >>>>"
, e));
18.
e.printStackTrace();
19.
}
finally
{
20.
ConnectionUtil.closeConnection(conn, ps);
21.
}
22.
}