0

as I read in javadoc resultset represents a table which contain
database therefore I want to know if there are a general way to iterate this result set and return data of it.
on other side the interface result set contain method getString(int coloumindex), how can I implement this method?

3
Contributors
7
Replies
8
Views
6 Years
Discussion Span
Last Post by Ezzaral
0

I'm already reading this tutorial but this tutorial doesn't contain any implementation for interface Resultset.

0

Are you writing a JDBC driver? If not, they you don't need to implement that interface. You use it to work with the results returned from a query.

0

yes, I'm implementing a JDBC driver and still having the same problem

0

Then you can implement it however you choose as long as it conforms to the documented behavior of the interface.

If you do not understand interface implementation, I don't see how you are going to be able to write your own JDBC driver.

Are you sure you aren't confusing "implementing an interface" with "using an interface"?

0

yes, I mean the difference .

for example if I want to implement method getString(int coloumindex) therefore I want to iterate on result set and choose the specific element in specific given no of coloum .I will implement that by declaring string[][] in class result set and then to find the value of any coloum, I will make a for loop on string[][].
but I think that that algorithm is not efficient because I declared a variable in class resultSet. so if any body having other algorithm tell me.

Edited by eman 22: n/a

1

getString() returns the value of the column in the current row of the result set. This means that you already have a reference to the row or its location, so it is simply a matter of returning the value of the column as a String. Your iteration or access methods will need to maintain that reference to the current row.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.