0 votes
in JDBC by
What is Statement & ResultSet in JDBC?

1 Answer

0 votes

JDBC Statement:
java.sql.Statement is an interface. It provides methods to submit SQL queries to the database. It will be implemented by driver implementation providers. With the help of createStatement() method you can get Connection object and return Statement object.

JDBC ResultSet:
java.sql.ResultSet is an interface and it is used to retrieve SQL select query results. A ResultSet object maintains a cursor pointing to its current row of data. Initially the cursor is positioned before the first row. The next method moves the cursor to the next row, and because it returns false when there are no more rows in the ResultSet object, it can be used in a while loop to iterate through the result set. It provides getXXX() methods to get data from each iteration.

Where XXX represents datatypes ex- int,float,double and string etc.

Share:- Whatsapp Facebook Facebook

Welcome to Developerhelpway Q&A, where you can ask questions and receive answers from other members of the community.