Java JDBC SQL Update a record example
To insert a record in database in SQL using JDBC, you need to perform below mentioned steps:
1) Create the database connection. There are two ways to get the DB connection. One is through java.sql.DriverManager and another is through javax.sql.DataSource. Click on below links for specific configuration.
2) Create a PreparedStatement object using sql query:
PreparedStatement fielStatement = connection.prepareStatement(SQL_STRING);
3) Execute sql statement: This is done using execute() method of PreparedStatement object
fielStatement.execute();
To insert a record in database in SQL using JDBC, you need to perform below mentioned steps:
1) Create the database connection. There are two ways to get the DB connection. One is through java.sql.DriverManager and another is through javax.sql.DataSource. Click on below links for specific configuration.
2) Create a PreparedStatement object using sql query:
PreparedStatement fielStatement = connection.prepareStatement(SQL_STRING);
3) Execute sql statement: This is done using execute() method of PreparedStatement object
fielStatement.execute();