Code example for PreparedStatement

Methods: close, executeQuery, setString

0
			 
			checkformentryst  = connection.prepareStatement(sel);
			// TODO : session is useless here, because 
			// it is not a stable identifier between security-proxified webapps 
			// anyway it is not used in case of anonymous extraction requests. 
			checkformentryst.setString(1, session);
			checkformentryst.setString(2, username);
			// Extra \n to be removed with the trim() call 
			checkformentryst.setString(3, jsonSpec.trim());
			 
			rs = checkformentryst.executeQuery();
			 
			rs.next();
			int numResults = rs.getInt(1);
			 
			ret = (numResults > 0);
			 
			 
		} catch (Exception e) {
			LOG.error("Error occured while trying to check form validation", e);
		} finally { 
			if (rs != null) try { rs.close(); } catch (Exception e) {}
			if (checkformentryst != null) try { checkformentryst.close(); } catch (Exception e) {}
			if (connection != null) try { connection.close(); } catch (Exception e) {}
		} 
		return ret;
	}