Connection conn = null;
PreparedStatement pstm = null;
ResultSet rs =) null;
try{
//DRIVER; URL, USERNAME y PASSWORD son constantes
conn = DriverManager.getConnection(DRIVER, URL, USERNAME, PASSWORD);
//Seleccionamos todos los campos de la tabla, el ID es el numero de identificacion que tu comentas
pstm = conn.preparedStatement("Select * from tabla where ID = ?");
//id es una variable con el valor a buscar
pstm.setInt(1, id);
rs = pstm.executeQuery();
if(rs.next()){
String nombre = rs.getString("nombre");
String ciudad = rs.getString("Ciudad");
String direccion = rs.getString("Direccion");
//revisa el API del ResultSet para que veas que otros metodos hay para obtener
//los diferentes tipos de datos que maneja la base de datos.
}else{
//NO SE ENCONTRO NADA
}
}catch(Exception ex){
//ERROR AL EJECUTAR EL CODIGO
ex.printStackTrace();
}finally{
//CERRAMOS LOS RECURSOS, ESTA ES LA MEJOR FORMA DE HACERLO
//NO OMITAS EL FINALLY
if(rs != null){
try{
rs.close();
}catch(Exception ex){}
}
if(pstm != null){
try{
pstm.close();
}catch(Exception ex){}
}
if(conn != null){
try{
conn.close();
}catch(Exception ex){}
}
}
Saludos,
_____________________
Ing. Gabriel Gutiérrez