Почему-то ниже приведённый код не сбрасывает сессии... я правильное значение подставляю как id сессии?
Код:
Connection con = connectionSet2.getConnection();
Statement stmt = con.createStatement();
String SQL = "select
is1.id as sessionID
from contract c
left join contract_balance cb on c.id=cb.cid
left join inet_serv_1 is1 on is1.contractId = c.id
left join inet_connection_1 ic1 on ic1.servId = is1.Id
where ((cb.summa1+cb.summa2-cb.summa3-cb.summa4) >= 0) and (cb.yy = YEAR (NOW())) and (cb.mm=MONTH(NOW())) and (is1.id is not NULL) and (is1.deviceid=5) and (is1.dateFrom<NOW()) and (is1.dateTo>NOW() or (is1.dateTo is NULL)) and (ic1.deviceState=1) and (ic1.status IN (0,1,2)) and (ic1.acctSessionId is NOT NULL) and (INET_NTOA(CONV(HEX(ic1.ipAddress),16,10)) LIKE '10.225.%' )";
logger.debug(ARROW+SQL);
ResultSet res = stmt.executeQuery(SQL);
InetSessionDao ISD = new InetSessionDao(con,1);
java.util.Date Dt = new java.util.Date();
while (res.next())
{
long str = Long.parseLong(res.getString("sessionID"));
if (RUMPEL)
{ if (ISD.closeSession(str, Dt)) { logger.info(ARROW+": сессия закрыта!"); }
else { logger.info(ARROW+": какая-то ошибка с закрытием сессии"); } }
else
{
logger.info(ARROW+res.getString("ID")+" "+res.getString("sessionID")+" "+Dt);
logger.info(ARROW+": учебный режим!");
}
}
try { if (stmt != null) stmt.close(); } catch (SQLException e) { e.printStackTrace(); }
}