您好,当我尝试将图像存储在数据库中时,出现此异常(phpmyadmin) 这是`java.lang.AbstractMethodError:方法com / mysql / jdbc / ServerPreparedStatement.setBlob(ILjava / io / InputStream;)V是抽象的
这是我得到异常的代码
public int createUser(String username, String password, InputStream image) throws SQLException {
try {
ps = con.prepareStatement(INSERT_USER_QUERY);
ps.setString(1, username);
ps.setString(2, password);
ps.setBlob(3, image);
return ps.executeUpdate();
} catch (SQLException ex) {
} finally {
ps.close();
}
return -1;
}
在这里我使用该方法
public void regAction() throws FileNotFoundException, SQLException {
if (validateRegisterFields()) {
InputStream in = new FileInputStream(new File(registerView.getImage()));
int created = userManger.createUser(registerView.getUsernameJTextfield().getText(), registerView.getPasswordJPasswordField().getText(), in);
if (created != 0) {
JOptionPane.showMessageDialog(registerView, "Done the user has been created");
} else {
JOptionPane.showMessageDialog(registerView, "There was an error");
}
} else {
JOptionPane.showMessageDialog(registerView, "Error empty Field");
}
}
我在代码中找不到错误..那是什么问题?