package DB;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class InsertEx
public static void main(String[] args) {
//step1 load the driver class
try {
[Link]("[Link]");
//step2 create the connection object
Connection
con=[Link]( "jdbc:oracle:thin:@localhost:1521:xe","system","1234");
[Link]("data base connectected successfuly");
//step3 create the statement object
PreparedStatement stmt=[Link]("insert into emp values
(?,?,?)");
[Link](1,400);
[Link](2, 7);
[Link](3, " London");
int i=[Link]();
[Link]("record inserted "+i);
//step5 close the connection object
[Link]();
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
[Link](e);
package DB;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class SelectTest
public static void main(String[] args) {
//step1 load the driver class
try {
[Link]("[Link]");
//step2 create the connection object
Connection
con=[Link]( "jdbc:oracle:thin:@localhost:1521:xe","system","1234");
[Link]("data base connectected successfuly");
//step3 create the statement object
Statement stmt=[Link]();
//step4 execute query
ResultSet rs=[Link]("select * from emp ");
while([Link]())
[Link]([Link](1)+" "+[Link](2)+" "+[Link](3));
//step5 close the connection object
[Link]();
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
[Link](e);
package DB;
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
import [Link];
public class UpdateEx
{
public static void main(String[] args) {
//step1 load the driver class
try {
[Link]("[Link]");
//step2 create the connection object
Connection
con=[Link]( "jdbc:oracle:thin:@localhost:1521:xe","system","1234");
[Link]("data base connectected successfuly");
//step3 create the statement object
PreparedStatement stmt=[Link]("update emp set
empname=? where empId=?");
[Link](1, "Talor");
[Link](2, 400);
int i=[Link]();
[Link]("records updated"+i);
//step5 close the connection object
[Link]();
} catch (ClassNotFoundException | SQLException e) {
// TODO Auto-generated catch block
[Link](e);