//Batch Update
import java.sql.*;
class BatchUpdate
{
public static void main(String arg[])
{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","student","student");
Statement s=c.createStatement();
String s1="update Emp set name='Mukta' where salary>2300";
String s2="insert into Emp values(124 ,'Mayank',50000) ";
s.addBatch(s1);
s.addBatch(s2);
s.executeBatch();
}
catch(Exception e)
{
System.out.print(e);
}
}
}
import java.sql.*;
class BatchUpdate
{
public static void main(String arg[])
{
try{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection c=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","student","student");
Statement s=c.createStatement();
String s1="update Emp set name='Mukta' where salary>2300";
String s2="insert into Emp values(124 ,'Mayank',50000) ";
s.addBatch(s1);
s.addBatch(s2);
s.executeBatch();
}
catch(Exception e)
{
System.out.print(e);
}
}
}
No comments:
Post a Comment