JDBC query is getting executed!
Posted on 2004-04-08
I have a query in UDB, it getting executed at the SQL command prompt.
db2 => SELECT HOUR(TSTAMP), COUNT(MSGID) FROM DB2A.MQMG WHERE DATE(TSTAMP
)=DATE('2004-04-01-00.00.00') GROUP BY HOUR(TSTAMP)
It's giveing result very nicely.
But the same query i am trying to execute in Java using prepareStatement. It's giving error when the query is getting executed
here is my code..
String query = "ALLMSG_HOUR_CNT","SELECT HOUR(TSTAMP), COUNT(MSGID) FROM DB2A.MQMG WHERE DATE(TSTAMP)=DATE(?) GROUP BY HOUR(TSTAMP)"
reparedStatement pstmt = conn.prepareStatement(query);
String sqlDate = "2004-04-01-00.00.00";
ResultSet rs = pstmt.executeQuery();
It's giving error in the last line
I appreciate ur help!