JDBC Execute Update query is used to modify or return you an integer value specify the number of rows affected in the backend of database.
The code illustrates a simple example from JDBC Execute update Example. In this Tutorial we want to describe you a code that helps you in understanding JDBC Execute update Example. For this we have a class JDBC Execute update, Inside this class we have a main method that include the list of following steps to be followed -The first step is to import a package java.sql.* -The * specify the list of all the classes defined in this package that provides you an network interface for java front end application to communicate with backend database.
Loading a driver is the next step to be followed by make a call to Class.forName( ) with driver class passed as argument.
DriverManager.getConnection ( ) : This method return you a connection class object. This try to built a connection between Url and database.
con.createStatement ( ) : This is used to return you Sql object. A connection object is used to send and execute sql query in the backend database.st.executeUpdate ( ) : This method return you an integer value, this specify the number of rows to be affected in the table .
In case there is an exception in the try block, the subsequent catch block handle the exception and print it. On the execution of program, the code show you an updated item in the table.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial