Guest User

Untitled

a guest
Apr 18th, 2017
27
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. import java.sql.*;
  2. public class GUItest {
  3. private String query;
  4. private Statement s;
  5. private Connection c;
  6. private ResultSet rs;
  7. private PreparedStatement ps;
  8. public GUItest(){
  9. this.c=null;
  10. this.ps=null;
  11. this.rs=null;
  12. this.s=null;
  13. query=new String();
  14. }
  15. public void run() throws Exception{
  16. Class.forName("com.mysql.jdbc.Driver");
  17. c=DriverManager.getConnection("jdbc:mysql://localhost/db?user=root");
  18. s=c.createStatement();
  19. query="create table SC(id int not null,name varchar(40),Primary Key(id));";
  20. s.executeUpdate(query);
  21. }
  22.  
  23. public static void main(String agrs[]) throws Exception{
  24. GUItest t=new GUItest();
  25. t.run();
  26. }
  27. }
Add Comment
Please, Sign In to add comment