Code example for PreparedStatement

Methods: executeQuerysetStringclose

0
 
		boolean isit = false;
		ResultSet result = null;
		try { 
			stmt = con.prepareStatement(sql);
			stmt.setString(1, uo.getE());
			stmt.setString(2, uo.getP());
 
			result = stmt.executeQuery();
			if (result.first()) {
                uo.setId(result.getInt("id")); 
                uo.setN(result.getString("name"));
                isit = true;
           } else { 
				// System.out.println("UserBean Object Not Found!"); 
				isit = false;
			} 
		} catch (SQLException e) {
			e.printStackTrace();
		} finally { 
			if (result != null)
				result.close();
			if (stmt != null)
				stmt.close();
		} 
		return isit;
 
	} 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE