```java
public int add(Goods goods) {
try {
Class.forName(driver);
con= DriverManager.getConnection(url,user,password);
String sql="insert into gser(gname,price,mark) values(?,?,?)";
pstm.setObject(1,goods.getGname());
pstm.setObject(2,goods.getPrice());
pstm.setObject(3,goods.getMark());
row=pstm.executeUpdate();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
catch (SQLException throwables) {
throwables.printStackTrace();
}finally {
try {
if (rs!=null){
rs.close();
}
if (pstm!=null){
pstm.close();
}
if (con!=null){
con.close();
}
} catch (Exception e) {
e.printStackTrace();
}
}
return row;
}
```