JDBC ReusultSet Type
From: Showmethecode (showmethecode_at_gmail.com)
Date: 11/30/04
- Next message: Kwasi: "Re: Unable to have tags within tags??"
- Previous message: Andrew Thompson: "Re: Function not visible outside the NetBeans IDE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Nov 2004 07:34:06 -0800
I was exploring the resultset type in JDBC 2.0 & 3.0 API.
i wrote a very simple n basic code snippet which is as follows:
" Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("Select * from mytest");
int i = rs.getType();
if(i == ResultSet.TYPE_FORWARD_ONLY)
System.out.println("Forward Type Only");
if(i == ResultSet.TYPE_SCROLL_INSENSITIVE)
System.out.println("Scroll Insesitive");
if(i == ResultSet.TYPE_SCROLL_SENSITIVE)
System.out.println("Scroll Sensitive");
rs.absolute(3);
System.out.println("The Id is :" + rs.getInt(1));
System.out.println("The Name is :" + rs.getString(2));
rs.relative(-2);
System.out.println("The Id is :" + rs.getInt(1));
System.out.println("The Name is :" + rs.getString(2));"
After executing this snippet(within a class with main method and
neccessary classes loaded), i m able to pull up data and i saw that
the result type shown is "Forward Type Only" but still when i do
"rs.relative(-2);" it allows me to go back and print the correct
record ( i had 3 records in the table, so this statement prints the
first record).
How is this possible?
is FORWARD_ONLY type is not forward only in strict sense?
what exactly it means by Forward only?
TIA
~showmethecode
- Next message: Kwasi: "Re: Unable to have tags within tags??"
- Previous message: Andrew Thompson: "Re: Function not visible outside the NetBeans IDE"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]