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 replies to this topic
#1
Posted 27 October 2010 - 09:54 AM
|
|
|
#2
Posted 28 October 2010 - 08:55 AM
Ehm, you normally don't implement that yourself but just use the implementation that is supplied.
If you use SQL in java. You execute a statement, and it returns a ResultSet. Every method there has code inside it. It should allready work.
If you use SQL in java. You execute a statement, and it returns a ResultSet. Every method there has code inside it. It should allready work.
#3
Posted 28 October 2010 - 06:17 PM
I meant how can I implement methods in class resultset .and what's the difference between resultset and resulsetmetaData.
#4
Posted 28 October 2010 - 10:10 PM
If you, for whateve reason, want to make your own ResultSet class you just need your class to implement the ReseltSet interface.
In a Database you got the data and the metadata.
Metadata is data about the data. So the resultset contains what's inside the table, the metadata contains info about the layout of the table like number of columns etc.
Take a simple .txt file as an example. The text itself would be the data, the stuff that windows adds: created by, date, size of the file, name,... all this would be metadata.
public class Myclass implements ResultSet{
//Every method of the ResultSet interface must be coded here<<
}
somewhere else:
ResultSet mySet = new MyClass();
In a Database you got the data and the metadata.
Metadata is data about the data. So the resultset contains what's inside the table, the metadata contains info about the layout of the table like number of columns etc.
Take a simple .txt file as an example. The text itself would be the data, the stuff that windows adds: created by, date, size of the file, name,... all this would be metadata.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









