0
adminと他のユーザを登録しようとしていますが、私のコードは動作しません。誰でも助けてください?これは私のデータベースですテーブル。 http://s000.tinyupload.com/index.php?file_id=71664130076755188207jdbcを使用してmysqlにユーザを登録しようとしています
public static void main(String[]args)throws Exception {new Aregistration();
createTable();
}
//Table
public static void createTable() throws Exception{
try{
Connection conn = getConnection();
PreparedStatement create = conn.prepareStatement("CREATE TABLE IF NOT EXISTS admin(id int NOT NULL AUTO_INCREMENT,first_name varchar(45),last_name varchar(45),email varchar(320),password varchar(50),PRIMARY KEY(id))");
create.executeUpdate();
}catch(Exception e){System.out.println(e);}
finally {
System.out.println("System Updated");};
}
//End of Table
//Database
public static Connection getConnection() throws Exception{
try{
String driver = "com.mysql.jdbc.Driver";
String url = "jdbc:mysql://localhost:3306/admin?useSSL=false";
String username = "root";
String password = "toor";
Class.forName(driver);
Connection conn = DriverManager.getConnection(url,username,password);
System.out.println("Connected");
return conn;
}catch(Exception e){
System.out.println(e);
}
return null;
}
}
https://postimg.org/image/ltgqcgqzp/
https://postimg.org/image/r65kqlew5/
あなたがあなたのすべてのコードはどこのクラスがあるのpost.Butを投稿することができ、コードには問題はありません:?このような...
Aregistration.Andあなたはどのように管理者や他のユーザーを登録しますか?IDEの間違ったプロンプトは何ですか? – lhw1995