How to Create a User Registration Form in Java using MySQL Database? login and registration in java [With Source Code]
java database connection code at the top:
import java.sql.* Connection con; PreparedStatement ps;
code: [register button clicking event]
try { // TODO add your handling code here: con= DriverManager.getConnection("jdbc:mysql://localhost/javaregister","root","admin"); String insertQuery= "INSERT INTO javaregister VALUES(?,?,?,?,?,?,?,?)"; ps=con.prepareStatement(insertQuery); ps.setString(1,txtEmail.getText()); ps.setString(2,txtPass.getText()); ps.setString(3,txtFname.getText()); ps.setString(4,txtLname.getText()); ps.setString(5,txtAdd.getText()); ps.setString(6,cmbGender.getSelectedItem().toString()); ps.setString(7,txtEmail.getText()); ps.setString(8,datePicker.toString()); ps.execute(); JOptionPane.showMessageDialog(null, "Register Successfully"); } catch (SQLException ex) { Logger.getLogger(Registration.class.getName()).log(Level.SEVERE, null, ex); }