This week's book giveaways are in the iOS and Features new in Java 8 forums. We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line! See this thread and this one for details.
Hi all, I wrote a SQL query which is a join between 2 table, which has also got group by functions etc. The Query executed perfectly in the DB. I am using MSAccess as the Database. The query returned 4 rows and 2 columns which is correct. So everything is fine on the DB side. When I executed the same query in Java, using JDBC, I used a scrollable resultset. I want to convert this Resultset in to a 2 dimensional String array. So I found the number of rows by scrolling through the resultset and incrementing a int variable. The Funniest thing is instead of return 4 its returning 12. That is it say there are 12 rows but as per the query results on the DB side there are only 4 rows. How is this possible. But when I did the same thing using PreparedStatement, without scrolling resultset I am getting correct results. Can anyone please explain me why this is happening Any help on this is very much Appreciated
I have no idea, and I haven't used Access from JDBC or scrollable result sets. I can, however, tell you that others will be more likely to help if you post your code, the query, the driver you're using, and the JDK version. Also, are you running this in a straight Java application or from within a J2EE container like Tomcat, WebLogic, JBoss, etc?
Joined: Aug 02, 2003
hi all, I am using Just Textpad to run the program as an application. The Java version is 1.4.1_02. I am pasting my code here.
Error I got
This query has to return only 4 records but I am not sure why the rs.next() is still giving true even after the 4th record.
[edited to add line break in query so page doesn't scroll right] [ January 29, 2005: Message edited by: Jeanne Boyarsky ]