protected PreparedStatement getPreparedStatement(String sql) throws SQLException {
		Connection conn = db.getConnection();
		PreparedStatement ps = null;
		try {
			if(conn.getMetaData().supportsGetGeneratedKeys()) {
				
					ps = conn.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS);
				
			} else {
				ps = conn.prepareStatement(sql);
			}
		} catch (SQLException e) {
			log.log(Level.SEVERE, "getPreparedStatement failed: " + e.getMessage(), e);
			throw e;
		}
		
		return ps;
			
	}