Guest User

Untitled

a guest
Oct 15th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5.  
  6. package conn1;
  7.  
  8.  
  9. import java.sql.*;
  10.  
  11.  
  12. /**
  13. *
  14. * @author asus
  15. */
  16. public class Main {
  17.  
  18. /**
  19. * @param args the command line arguments
  20. */
  21. public static void main(String[] args) throws Exception {
  22. // TODO code application logic here
  23. String query="insert into main values('jdbcc',1)";
  24. Class.forName("com.mysql.jdbc.Driver");
  25. Connection con=DriverManager.getConnection("jdbc:mysql://localhost/test:3306","localhost ", " ");
  26. Statement st=con.createStatement();
  27. int count=st.executeUpdate(query);
  28. con.close();
  29.  
  30. }
  31.  
  32. }
Add Comment
Please, Sign In to add comment