private static final Log log = LogFactory.getLog(AppUserDaoImpl.class);
@Override
public Boolean updateImg(String userId, String url) {
// TODO Auto-generated method stub
String sql = "update org_employee set sphoto=? where id=?";
Connection conn = null;
PreparedStatement ps = null;
try {
conn = DBConnection.getConnection();
if (conn == null) {
log.error("AppUserDaoImpl: 无法获得数据库连接!");
throw new SQLException("AppUserDaoImpl: 无法获得数据库连接!");
}
ps = conn.prepareStatement(sql);
int i = 1;
ps.setString(i++, url);
ps.setString(i++, userId);
ps.executeUpdate();
} catch (Exception ex) {
log.error("InsertParkmsg异常" + ex);
} finally {
DBConnection.closeConnection(conn);
}
return true;
}
jdbc交互数据库
最新推荐文章于 2020-09-30 10:27:16 发布
