I have a problem here, what i wanna do is getting current date and a column from a table. Here is my code so far :
s = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY);
rset = s.executeQuery("select getdate() as date, tglpengiriman from orders");
java.sql.Date date = rset.getDate("date");
java.sql.Date tglkirim = rset.getDate("tglpengiriman");
And throwing exception "no current row in ResultSet" in line 3 of my code above. What's wrong with my code? Missunderstanding usage of ResultSet, maybe?
Thanks for any answer...
EDIT: answered. Please see post from @Christopher below. Thanks
You need to call ResultSet.next before you call any of the ResultSet.get* methods. Take a look at the documentation for Statement, ResultSet, etc. Also be sure to close all your resources in a 'finally' block.