String sql=
"select *\n"+
"FROM EVENTS a \n"+
" where \n"
" a.TIME_RECEIVED BETWEEN ? AND ?\n"
" and a.original_data like ?\n"
" order by a.time_created"
try (Connection conn = DriverManager.getConnection(DB_URL_Connection, DB_UserName, DB_Password)) {
PreparedStatement prepStmt = conn.prepareStatement(sql);
prepStmt.setDate(1, new java.sql.Date(fDATETIME.getTime()));
prepStmt.setDate(2, new java.sql.Date(tDATETIME.getTime()));
prepStmt.setString(3, "%Хост: %");
ResultSet result = prepStmt.executeQuery(sql);
Calendar fDATETIME = Calendar.getInstance(); // creates calendar
Calendar tDATETIME = Calendar.getInstance();
SimpleDateFormat ShortDateFormat = new SimpleDateFormat("dd.MM.yyyy HH:mm:ss");
SimpleDateFormat DateFormatForSQLOracle = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
fDATETIME.setTime(ShortDateFormat.parse(DATETIME_FROM));
tDATETIME.setTime(ShortDateFormat.parse(DATETIME_TO));
try (Connection conn = DriverManager.getConnection(DB_URL_Connection, DB_UserName, DB_Password)) {
PreparedStatement prepStmt = conn.prepareStatement(sql);
prepStmt.setTimestamp(1, java.sql.Timestamp.valueOf(DateFormatForSQLOracle.format(fDATETIME.getTime())));
prepStmt.setTimestamp(2, java.sql.Timestamp.valueOf(DateFormatForSQLOracle.format(tDATETIME.getTime())));
prepStmt.setString(3, "%Хост: %");
ResultSet result = prepStmt.executeQuery();