Guest User

select

a guest
Apr 30th, 2019
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. import java.io.*;
  2. import java.sql.*;
  3. class InsertIntoTable
  4. {
  5. public static void main(String args[])throws SQLException, Exception{
  6. Class.forName("com.mysql.jdbc.Driver");
  7. Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/SaicharanPogul","root","eswecha");
  8. Statement st = con.createStatement();
  9. int result = st.executeUpdate("insert into student values('Saicharan','Pogul', 1)");
  10. if(result > 0){
  11. System.out.println("Insertion Successfull");
  12. }
  13. else{
  14. System.out.println("Insertion Unsuccessfull");
  15. }
  16. con.close();
  17. st.close();
  18. }
  19. }
Add Comment
Please, Sign In to add comment