Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.sql.*;
- public class GUItest {
- private String query;
- private Statement s;
- private Connection c;
- private ResultSet rs;
- private PreparedStatement ps;
- public GUItest(){
- this.c=null;
- this.ps=null;
- this.rs=null;
- this.s=null;
- query=new String();
- }
- public void run() throws Exception{
- Class.forName("com.mysql.jdbc.Driver");
- c=DriverManager.getConnection("jdbc:mysql://localhost/db?user=root");
- s=c.createStatement();
- query="create table SC(id int not null,name varchar(40),Primary Key(id));";
- s.executeUpdate(query);
- }
- public static void main(String agrs[]) throws Exception{
- GUItest t=new GUItest();
- t.run();
- }
- }
Add Comment
Please, Sign In to add comment