Code example for PreparedStatement

Methods: executeQuerysetStringclose

0
			throw new IllegalArgumentException("Usuário não deve ser nulo");
		} 
		 
		try { 
			PreparedStatement stmt = this.connection.prepareStatement("select * from usuarios where login = ? and senha = ?");
			stmt.setString(1, usuario.getLogin());
			stmt.setString(2, usuario.getSenha());
			ResultSet rs = stmt.executeQuery();
 
			boolean encontrado = rs.next();
			rs.close();
			stmt.close();
 
			return encontrado;
		} catch (SQLException e) {
			throw new RuntimeException(e);
		} 
	} 
} 
 
Stop searching for code, let great code find you!  Add Codota to your java IDE