Hi,
Hope you are all doing great. Let's learn together.
Join Telegram: 📲 https://t.me/contactajoydebnath
Chapters ❤
0:00 Introduction
03:10 Theory
10:59 The Next Method
14:26 Variants of the Getter Method
18:53 The Previous Method
24:49 The AfterLast Method
28:14 The BeforeFirst Method
29:44 The Absolute Method
31:30 The First and Last Method
Note:
JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the query with the database. It is a part of JavaSE (Java Standard Edition). JDBC API uses JDBC drivers to connect with the database.
Video Links:
Core Java Playlist:
• Core Java
Spring Playlist:
• Spring Framework
Video Link:
JDBC established a connection with the database. -- • JDBC, established connection with database...
JDBC, DatabaseMetaData interface. -- • JDBC, DatabaseMetaData interface. JDBC-Ep:...
JDBC, Statement interface. JDBC. -- • JDBC, Statement interface. JDBC-Ep:3 #jdbc...
JDBC, ResultSet interface. -- • JDBC, ResultSet interface. Part:1 JDBC-Ep:...
Document Link -
https://docs.google.com/document/d/1i...
https://docs.google.com/document/d/1U...
Like, Comment, Share, and Subscribe.
Thank you again.
Eclipse Download
https://www.eclipse.org/downloads/pac...
JDK Link:
https://www.oracle.com/java/technolog...
MySQL Connector JAR
https://mvnrepository.com/artifact/my...
MySQL Installer
https://dev.mysql.com/downloads/insta...
JDBC
The JDBC API is a Java API that can access any kind of tabular data, especially data stored in a relational database.
Tabular Data: A tabular database, as the name implies is a database that is structured in a tabular form. It arranges data elements in vertical columns and horizontal rows. Each cell is formed by the intersection of a column and a row.
Connection Interface:
A Connection is a session between a Java application and a database. The object of Connection can be used to get the object of Statement and DatabaseMetaData. The Connection interface provides many methods for transaction management like commit(), rollback(), etc.
Result Set Operation:
ResultSet Object is used to access query results retrieved from the relational databases. ResultSet maintains a 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.
The method next() moves the cursor forward one row from its current position.A ResultSet cursor is initially positioned before the first row; the first call to the method next makes the first row the current row; the second call makes the second row the current row, and so on.
When a call to the next method returns false, the cursor is positioned after the last row.
We can obtain data from ResultSet using getter methods provided by it. e.g. getInt(), getString(), getDate().
All the getter methods have two variants. 1st variant takes column index as Parameter and 2nd variant accepts column name as Parameter.
Finally, we need to call the close method on the ResultSet instance so that all resources are cleaned up properly.
boolean next() throws SQLException: This method moves ResultSet cursor to the next row.
boolean previous() throws SQLException: This method moves ResultSet cursor to the previous row.
void afterLast() throws SQLException**:** This method moves ResultSet cursor to the position after the last row.
void beforeFirst() throws SQLException**:** This method moves ResultSet cursor to the position before the first row.
boolean absolute(int row) throws SQLException**:** This method moves ResultSet cursor to the specified row and returns true if the operation is successful.
boolean first() throws SQLException: This method moves ResultSet cursor to the first row.
boolean last() throws SQLException: This method moves ResultSet cursor to the last row.
resultSet.moveToInsertRow(); – Moves the cursor to the insert row. The current cursor position is remembered while the cursor is positioned on the insert row. The insert row is a special row associated with an updatable result set. It is essentially a buffer where a new row may be constructed by calling the updater methods prior to inserting the row into the result set. Only the updater, getter, and insertRow methods may be called when the cursor is on the insert row. All of the columns in a result set must be given a value each time this method is called before calling insertRow. An updater method must be called before a getter method can be called on a column value.
resultSet.update*{int,string..}({column name}, {value});
resultSet.insertRow();