Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class JDBCDemo2{
- public static void main(String[] args) throws Exception{
- Class.forName("oracle.jdbc.driver.OracleDriver");
- Connection con=DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE","system","root");
- Statement st=con.createStatement();
- String s="update Student_Table2 set id='2' where name='Vineeth'";
- st.executeUpdate(s);
- String q1="delete from Student_Table2 where name='Vineeth'";
- PreparedStatement ps=con.prepareStatement(q1);
- ps.execute();
- ResultSet rs=st.executeQuery("select * from Student_Table2");
- while(rs.next()){
- System.out.println(rs.getString(1)+" "+rs.getString(2));
- }
- rs.close();
- con.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment