Hello guys,
In this video, I am explaining my knowledge about retrieving data from the database to the JTable. forgive for the mistakes.
RESULTSET
--------------
ResultSet
The Java JDBC ResultSet interface represents the result of a database query. The text about queries shows how the result of a query is returned as a java.sql.ResultSet. This ResultSet is then iterated to inspect the result.
ResultSet maintains cursor/pointer which points to a single row of the query results. Using navigational and getter methods provided by ResultSet, we can iterate and access database records one by one.
Creating a ResultSet
You create a ResultSet by executing a Statement or PreparedStatement, like this:
Statement statement = connection.createStatement();
ResultSet result = statement.executeQuery("select * from people");
Or like this:
String sql = "select * from people";
PreparedStatement statement = connection.prepareStatement(sql);
ResultSet result = statement.executeQuery();
--------------------------------------------------------------
Let's Learn Together :)
#JTable #advancedjava #database