Unlikely.You have to find some other ways to find the number of records for that.DB2 with versions 7.1 and higher,gives the record number of an query with a function for example.
Salih Sipahi
Software Engineer.
City of Istanbul Turkey
s.sipahi@sahinlerholding.com.tr
Please examine this code below:
try{
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver"
String url = "jdbc:db2:OGER2002" ;
java.sql.Connection connection = java.sql.DriverManager.getConnection(url, "db2admin", "db2admin"
java.sql.Statement stmt =connection.createStatement();
java.sql.ResultSet rs = stmt.executeQuery("select * from genparam.citylist"
System.out.println(rs.getFetchSize()+ "Fetch Size"
int i = 0;
while (rs.next()){
System.out.println(++i);
}
}
catch (Exception ex){
System.out.println(ex.toString());
}
That is taken from my database OGER2002 and genparam.citylist table.
Here is the console print messages of the code.
1Fetch Size
1
2
3
4
5
6
7
8
9
10
11
goes to 42 ( I didnt write it down up to 42 of course here)
the fetch size DOES NOT give you the number of records.
And size of a row DOES NOT mean the number of records also.
You can find number of columns,tables,foreign key by ResultSetMetaData but NOT this.
Salih Sipahi
Software Engineer.
City of Istanbul Turkey
s.sipahi@sahinlerholding.com.tr
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.