public void adduser(UserBean user) throws SQLException{
String query = "INSERT INTO usersInformation ( username, " +
"password, email ) VALUES ( '" + user.getUsername() + "', '" +
user.getPassword() + "', '" + user.getEmail() + "' )" ;
statement.execute(query);
}
I get this exception in this line : statement.execute(query) Can anyone helps me ? Exception : was aborted because it would have caused a duplicate key value in a unique or primary key constraint or unique index identified by 'SQL140525011235350' defined on 'USERSINFORMATION'.
[EDITED]
This is my bean class
public class UserBean {
private String username;
private String password;
private String email;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
}
index.jsp ( Mail part of index.jsp )
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id = "userbean" class = "newpackage.UserBean" />
<jsp:useBean id = "userdatabean" class = "newpackage.UserDataBean" />
<jsp:setProperty name ="userbean" property="*"/>
<% userdatabean.adduser(userbean); %>