Guest User

Untitled

a guest
Mar 1st, 2019
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import java.sql.*;
  2. class insertJDBC
  3. {
  4. public static void main(String args[])throws Exception
  5. {
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/VCE","root","eswecha");
  8. Statement st=con.createStatement();
  9. int result=st.executeUpdate("insert into emp values(101,'ravi')");
  10. if(result>0)
  11. System.out.println("inserted");
  12. else
  13. System.out.println("not inserted");
  14. con.close();
  15. st.close();
  16. }
  17. }
Add Comment
Please, Sign In to add comment