This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
What type of object is returned when a ResultSet is executed??
Tx, Karthik
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
posted
0
ResultSet never get executed. Its the statement which get executed. When a statement is executed a resultset is returned which contains all the records which the specified statement has fetch.
Wayne L Johnson
Ranch Hand
Joined: Sep 03, 2003
Posts: 399
posted
0
To add a little to the previous response, when dealing with a Statement, there are three types of execute methods:
1) "executeQuery()" is used for doing a SELECT statement, and will return a ResultSet.
2) "executeUpdate()" is used for doing a DELETE, UPDATE or INSERT statement, and will return an int (number of rows affected).
3) "execute()" is used for multiple operations, or when the query type is unknown, and will return a boolean (read the doc as to the meaning since it's too complicated to explain here).
Some databases will let you get away with calling "executeQuery()" with a DELETE, UPDATE or INSERT, and others are more strict. But it's good to get in the habit of calling the appropriate method.
While it's true that you can't execute a ResultSet, with the JDBDC 2.0 specification you can udpate the database via the ResultSet. The methods are all "void", so don't return anything.
Cheers ... [ May 20, 2004: Message edited by: Wayne L Johnson ]
Ananth Ram
Ranch Hand
Joined: Jan 18, 2001
Posts: 99
posted
0
I meant when statement is excuted ResultSet is returned and what is the nature of it, is that in the form of objects, records, etc...?? [ May 24, 2004: Message edited by: Karthik Ganesh ]
When statement is executed it return the object of ResultSet. This resultset object contains all the data from database table which is returned by your specified query.
You can navigate resultset using its next() and previous() methods or fist() and last() methods. You can get the data against any column using getXXX() methods of Resultset.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.