Я пытаюсь вставить данные в базу данных, используя приведенный ниже код, но что-то работает неправильно. Он работает без ошибок, но ничего не вставляет в базу данных.
public Map<String,String> createuser(String handle, String password, String fullname, String location, String xmail, String bdate)
{
Map<String,String> userIdMap = new HashMap<>();
PreparedStatement stmt = null;
try
{
Connection conn = ds.getConnection();
String queryString = null;
queryString = "INSERT INTO Identity(handle, password, fullname, location, xmail, bdate) VALUES (?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(queryString);
stmt.setString(1, handle);
stmt.setString(2, password);
stmt.setString(3, fullname);
stmt.setString(4, location);
stmt.setString(5, xmail);
stmt.setString(6, bdate);
userIdMap.put(handle, password);
userIdMap.put(fullname, location);
userIdMap.put(xmail, bdate);
int s = stmt.executeUpdate(queryString);
stmt.close();
conn.close();
}
catch(Exception ex)
{
ex.printStackTrace();
}
return userIdMap;
} // createuser()
Возможное сообщение об ошибке
<html><head><title>Grizzly 2.3.23</title><style><!--div.header {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#003300;font-size:22px;-moz-border-radius-topleft: 10px;border-top-left-radius: 10px;-moz-border-radius-topright: 10px;border-top-right-radius: 10px;padding-left: 5px}div.body {font-family:Tahoma,Arial,sans-serif;color:black;background-color:#FFFFCC;font-size:16px;padding-top:10px;padding-bottom:10px;padding-left:10px}div.footer {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#666633;font-size:14px;-moz-border-radius-bottomleft: 10px;border-bottom-left-radius: 10px;-moz-border-radius-bottomright: 10px;border-bottom-right-radius: 10px;padding-left: 5px}BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;}B {font-family:Tahoma,Arial,sans-serif;color:black;}A {color : black;}HR {color : #999966;}--></style> </head><body><div class="header">Request failed.</div><div class="body">Request failed.</div><div class="footer">Grizzly 2.3.23</div></body></html>