PreparedStatement insert example in JDBC | JAVA JDBC Tutorial

This  | JAVA JDBC Tutorial “PreparedStatement insert example in JDBC” post providing implementation program that describes how to insert values into table using setter methods of PreparedStatement interface.


How to Construct PreparedStatement object?

  • First we need to construct Connection object using DriverManger class.
  • Connection interface providing pre-defined method to construct PreparedStatement object as follows…


Table creation :
SQL> create table online_student(sno number(5), sname varchar2(30), sfee number(7,2));


Insert Values into table:
SQL> insert into online_student values(1002 , ‘robert’ , 6000);
SQL> insert into online_student values(1003 , ‘raheem’, 6000);


SQL> select *from online_student; 

  • —————————
  • 1002  robert     6000
  • 1003  raheem  6000



Share this