location(database,rbsla,"jdbc:mysql://localhost/rbsla","root","").


on_db_exception() :-
	exception(Ex),
	println([Ex]),
	fail().

storeHappens(Event, Time) :-
	datetime_epoch(Time, TimeMS),
	X=rbsla.utils.contractQsc.Qsc(),
	X.saveHappens(Event, Time, TimeMS).
	
storeAvailability(Time, Server, Status) :-	
	Time = [N, Y, M, D, H, Min, Sec],
	concat([Y, "-", M, "-", D, " ", H, ":", Min, ":", Sec], TimeToInsert),
	on_exception(java.sql.SQLException,on_db_exception()),
	dbopen("rbsla", DB),
	sql_insert(DB, "availability", ["Host", "Stat", "Time"], [Server, Status, TimeToInsert]).