in reply to Re^6: DBI Problem
in thread DBI Problem

Ever think of looking at what is in session when you call ExecuteQuery?

see Re^8: DBI Problem, the problem is not in ExecuteQuery, the problem is where you try to do the $session->flush(); there is nothing to insure session has a valid value in ExecuteQuery.