I'm making a Sign Up form and I made everything but still it wont connect. I hope someone here can help.
My myConnection.java
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class myConnection {
public static Connection getConnection() {
Connection con = null;
try {
con = DriverManager.getConnection("jdbc:mysql://turtlenetwork.net/contact" + "user=IDKLMAO&password=OkIKnowYouTriedButNOLOL");
} catch (SQLException ex) {
// handle any errors
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}
return con;
}
}
SignUp
private void jLabelCreateMouseClicked(java.awt.event.MouseEvent evt) {
Connection con = myConnection.getConnection();
PreparedStatement ps;
try {
ps = con.prepareStatement("INSERT INTO `user`(`username`, `pass`, `mail`) VALUES (?,?,?)");
ps.setString(1, jTextField1.getText());
ps.setString(2, String.valueOf(jPasswordField1.getPassword()));
ps.setString(3, jTextField3.getText());
if (ps.executeUpdate() != 0) {
JOptionPane.showMessageDialog(null, "Account Created");
} else {
JOptionPane.showMessageDialog(null, "Failed");
}
} catch (HeadlessException | SQLException ex) {
Logger.getLogger(SignUp.class.getName()).log(Level.SEVERE, null, ex);
}
}
Here is the error that I get when I run click the create button.
It's supposed to write everything on the database and make that account.