Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package guii;
- import java.sql.*;
- public class guiii {
- private String query;
- private Connection conn;
- private Statement stat;
- private ResultSet re;
- private PreparedStatement pr;
- guiii(){
- conn=null;
- stat=null;
- re=null;
- pr=null;
- }
- public void run() throws ClassNotFoundException, SQLException{
- Class.forName("com.mysql.jdbc.Driver");
- conn=DriverManager.getConnection("jdbc:mysql://localhost/lab?user=root");
- stat=conn.createStatement();
- query="create table employee(id int(25) Primary key, name varchar(25))";
- stat.executeUpdate(query);
- }
- public static void main(String args[]) throws ClassNotFoundException, SQLException{
- guiii t=new guiii();
- t.run();
- }
- }
Add Comment
Please, Sign In to add comment