How can you retrieve data from the ResultSet using JDBC?
Submitted by: AdministratorFirst JDBC returns results in a ResultSet object, so we need to declare an instance of the class ResultSet to hold our results. The following code demonstrates declaring the ResultSet object rs.
E.g.
ResultSet rs = stmt.executeQuery(”SELECT COF_NAME, PRICE FROM COFFEES”);
Second:
String s = rs.getString(”COF_NAME”);
The method getString is invoked on the ResultSet object rs , so getString will retrieve (get) the value stored in the column COF_NAME in the current row of rs
Submitted by: Administrator
E.g.
ResultSet rs = stmt.executeQuery(”SELECT COF_NAME, PRICE FROM COFFEES”);
Second:
String s = rs.getString(”COF_NAME”);
The method getString is invoked on the ResultSet object rs , so getString will retrieve (get) the value stored in the column COF_NAME in the current row of rs
Submitted by: Administrator
Read Online JDBC Job Interview Questions And Answers
Top JDBC Questions
☺ | What packages are used by JDBC? |
☺ | What are the different types of Statements in JDBC? |
☺ | How can you make the connection using JDBC? |
☺ | How to Retrieve Warnings in JDBC? |
☺ | What are the two major components of JDBC? |
Top Java Programming Language Categories
☺ | Core Java Interview Questions. |
☺ | Hibernate Interview Questions. |
☺ | Advanced Java Interview Questions. |
☺ | IBM WebSphere Interview Questions. |
☺ | Spring Framework Interview Questions. |