My JSP is working great with a Java class that inserts and updates an Oracle 9i database. I am running single insert and single update statements in my program that is used about 10 times a week at most. The below is what I have been using and was wondering if it is efficient or anyway to improve it:
public class DbWork {
private Connection connection = new ConnectionMgr().getConnection(); private PreparedStatement stat;
public void cityInserter(FormBean city) throws SQLException { stat = connection.prepareStatement("Insert into City (street, school) values (?,?)"); stat.setString(1, city.getStreet()); stat.setString(2, city.getSchool()); stat.executeUpdate(); }
public void cityUpdater(FormBean city) throws SQLException { //update another table in the database using preparedstatements } .......