In this example, we will discuss the Prepared Statement interface and its usage in Java using examples. This interface creates an object that represents a precompiled SQL statement. This object can then be used to efficiently execute this statement multiple times. The PreparedStatement interface extends the Statement interface, which is used for executing a static SQL statement and returning the ...
Read More »Java JDBC ResultSet Example
In this example, we are going to demonstrate how to use Java JDBC ResultSet in order to get and manipulate data from a database. ResultSet is essentially a table, which contains all the information that should be returned from a specific query, as well as some essential metadata. You can also check this tutorial in the following video: Java JDBC ...
Read More »Determine if a ResultSet is updatable
With this example we are going to demonstrate how to determine if a ResultSet is updatable. An updatable ResultSet is a table of data representing a database result set, that can be updated by others. In short, to determine if a ResultSet is updatable you should: Load the JDBC Driver, using the forName(String className) API method of the Class. In ...
Read More »Determine if a database supports Updatable ResultSets
This is an example of how to determine if a database supports updatable ResultSets. When a database supports updatable ResultSets it means that modification to data in a table is allowed through a result set. Checking if a database supports updatable ResultSets implies that you should: Load the JDBC driver, using the ForName(String className) API method of the Class. In ...
Read More »Updatable ResultSet Example
In this example we shall show you how to use an updatable ResultSet. An updatable result set allows modification to data in a table through the result set. To create an Updatable ResultSet and use its capabilites for data updates in a database one should perform the following steps: Load the JDBC driver, using the forName(String className) API method of ...
Read More »Determine if a database supports Scrollable ResultSets
With this example we are going to demonstrate how to determine if a database supports scrollable ResultSets. Values captured in an insentitive scrollable result set never change, even if changes are made to the table from which the data was retrieved, whereas a sensitive scrollable result set is one where the current values in the table are reflected in the ...
Read More »Determine if a ResultSet is scrollable
This is an example of how to determine if a ResultSet is Scrollable. Checking if a ResultSet is scrollable or not implies that you should: Load the JDBC driver, using the forName(String className) API method of the Class. In this example we use the MySQL JDBC driver. Create a Connection to the database. Invoke the getConnection(String url, String user, String ...
Read More »Scrollable ResultSet example
In this example we shall show you how to create and use a scrollable ResultSet. To use a scrollable ResultSet one should perform the following steps: Load the JDBC driver, using the forName(String className) API method of the Class. In this example we use the MySQL JDBC driver. Create a Connection to the database. Invoke the getConnection(String url, String user, ...
Read More »Getting column names of a database table
With this example we are going to demonstrate how to get the column names of a database Table. In short, to get the column names of a database Table you should: Load the JDBC driver, using the forName(String className) API method of the Class. In this example we use the MySQL JDBC driver. Create a Connection to the database. Invoke ...
Read More »Retrieve data example
This is an example of how to retrieve data from a database. Retrieving data from a database implies that you should: Load the JDBC driver, using the forName(String className) API method of the Class. In this example we use the MySQL JDBC driver. Create a Connection to the database. Invoke the getConnection(String url, String user, String password) API method of ...
Read More »