I am trying to get the total count of a table rows using the below code.
Connection con = getJdeConnection(userN, password, hostN, dbName);
PreparedStatement p = con.prepareStatement("select count(*) from F0010");
System.out.print("\n----- Connection Success ---------------\n\n");
ResultSet rs = p.executeQuery();
if(rs.next()){
System.out.println("Query = select count(*) from F0010");
System.out.println("count = "+rs.getInt(1));
}else{
System.out.println("zero records");
}
The above code is running fine if am running the above code for my test table. Means it is giving the exact count. But I need to count number of rows in the above table F0010. This is a table in JD Edwards, contains 5203 records. The same sql when am running in JDE sql prompt it is giving count as 5203. But when am running this query from java code it is giving count as 0 (Zero).
My program is not throwing any exceptions.
Please help me. Thanks in advance.