import java.sql.*;
public class First {
public static void main(String[] args) {
// TODO Auto-generated method stub
Connection con=null;
try{
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
PreparedStatement stmt = con.prepareStatement("update second set empid=? where rollno=?");
stmt.setInt(1,200);
stmt.setInt(2,1);
stmt.executeUpdate();
con.close();
}catch (SQLException e) {
e.printStackTrace();
}
}
}
public class First {
public static void main(String[] args) {
// TODO Auto-generated method stub
Connection con=null;
try{
DriverManager.registerDriver(new com.mysql.jdbc.Driver());
con=DriverManager.getConnection("jdbc:mysql://localhost:3306/test","root","root");
PreparedStatement stmt = con.prepareStatement("update second set empid=? where rollno=?");
stmt.setInt(1,200);
stmt.setInt(2,1);
stmt.executeUpdate();
con.close();
}catch (SQLException e) {
e.printStackTrace();
}
}
}
output:-