When an SQL query executes, the results form a pseudo-table that contains all rows that fit the query criteria. For instance, here’s a textual representation of the results of the query string
"SELECT EMP_CODE, EMP_NAME, EMP_ADDRESS FROM EMPLOYEE":
This kind of textual representation is not very useful for Java programs. Instead, JDBC uses the
java.sql.ResultSet interface to encapsulate the query results as Java primitive types and objects. You can think of a ResultSet as an object that represents an underlying table of query results, where you use method calls to navigate between rows and retrieve particular column values.
Java program might handle the previous query as follows:
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery("SELECT EMP_CODE, EMP_NAME, EMP_ADDRESS FROM EMPLOYEE");
JDBC stands for
“Java Database Connectivity” JDBC is an API defined in the
javax.sql packages for connecting an arbitrary database to a Java program. JDBC is a set of classes and interfaces written in the Java programming language.