Edit: oops. These JDBC statements work; I had forgotten to commit in SQL Plus. Thanks Paul.
When I query the database with SQL Plus:
select count(tid) from retweets where tid = 35 => 2
select count(tid) from tweets where replyto = 35 => 1
I've tried several methods to pull these aggregate counts from the database through JDBC, but in all cases they returned 0.
Examples:
Statement stmt = m_con.createStatement();
ResultSet retweets = stmt.executeQuery("select count(tid) from retweets where tid = 35");
if (retweets.next()) { System.out.println("# of Retweets: " + retweets.getInt(1));}
ResultSet replies = stmt.executeQuery("select count(tid) Replies from tweets where replyto = "+tid);
if (replies.next()) {System.out.println("# of Replies : " + replies.getInt("Replies"));}
Both times, 0 was printed. Why did this happen and how can I fix it? Thanks.