registrieren Ich versuche, den Admin und andere Benutzer zu registrieren, aber mein Code funktioniert nicht.Kann jemand mir bitte helfen? Dies ist mein Code, den ich verwendet habe, um eine Datenbank zu erstellen und eine Tabelle. Diese ist der Link zum vollständigen Code: http://s000.tinyupload.com/index.php?file_id=71664130076755188207Ich versuche, Benutzer in mysql mit jdbc
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/
Es gibt kein Problem in dem Code Sie post.But können Sie alle Ihre Code schreiben Wo ist die Klasse Aregistration.And wie Sie den Admin und andere Benutzer registrieren.Was ist die falsche Eingabeaufforderung in der IDE? – lhw1995