con=L2DatabaseFactory.getInstance().getConnection()
rem=con.prepareStatement("DELETE FROM buffer_scheme_contents WHERE scheme_id=? AND skill_id=? AND skill_level=? LIMIT 1")
rem.setString(1, scheme)
rem.setString(2, skill)
rem.setString(3, level)
try :
rem.executeUpdate()
except :
pass
if getBuffCount(scheme) == 0 :
HTML = getOptionList(scheme)
else :
HTML = viewAllSchemeBuffs(scheme,eventParam2,"remove")
return HTML
if event == "add_buff" :
event = eventParam1.split("_")
scheme = event[0]
skill = event[1]
level = event[2]
idbuffclass = getclassbuff(skill)
con=L2DatabaseFactory.getInstance().getConnection()
ins = con.prepareStatement("INSERT INTO buffer_scheme_contents (scheme_id,skill_id,skill_level,buff_class) VALUES (?,?,?,?)")
ins.setString(1, str(scheme))
ins.setString(2, str(skill))
ins.setString(3, str(level))
ins.setString(4, str(idbuffclass))
try :
ins.executeUpdate()
ins.close()
con.close()
except :
pass
if getBuffCount(scheme) == MAX_BUFFS_PER_SCHEME :
HTML = getOptionList(scheme)
else :
HTML = viewAllSchemeBuffs(scheme,eventParam2,"add")
return HTML
I am using this script in Java aplication(gaming)and i keep getting error with unclosed connection!
I found there is on line :con=L2DatabaseFactory.getInstance().getConnection()
without ending with con.close()!
I am not sure where should i put con.close() after first on=L2DatabaseFactory.getInstance().getConnection()!