Posted on 2006-10-26
Wonder if any help can be rendered.
conn = null;
ps = null;
InitialContext initCtx = new InitialContext(env); // env has been initialised properly
DataSource ds = (DataSource)initCtx.lookup(dsJndi); // dsJndi has been initialised, but not sure if properly
conn = ds.getConnection();
String query = "SELECT * FROM TLWB_AHP_SESSIONS WHERE (STATUS = '0' OR STATUS = '00') AND TRANSACTION_DATE LIKE ? ORDER BY SESSION_ID ASC";
ps = conn.prepareStatement(query);
Upon reaching the last line, an error was thrown:
I tried to print out the value of conn.prepareStatement(query) but got the error as well. Does this error mean that prepareStatement is unable to accept "query" properly? I read that, this method throws SQLException when database access error occurs. But this error is ClassCastException. Does it have anything to do with database access? Or somehow, binding is not recognised?