I have a problem in implementing this case.
1) some examples show that we can use as in the following:
try{
bd.conectarBaseDeDatos();
PreparedStatement stmt;
String sql=("SELECT * FROM cab_pedido a, det_pedido b WHERE a.numero = b.numero and a.cod_agencia = b.cod_agencia");
System.out.println(sql);
stmt = bd.conexion.prepareStatement(sql,ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_READ_ONLY);
bd.result = stmt.executeQuery(sql);
}
catch (InstantiationException | IllegalAccessException | SQLException e){ System.out.println(e);}
return rs;
}
This returns my resultSet and I can use rs.next(). rs.previous(), etc to solve my problem, but I see some comments that say we should close rs and db connection. How dangerous is that? I can implement without closing the resultset and connection? Because when we close resultSet, I will not able to get data anymore.
2) Store the data into Hashmap or list This is another possibility but if I want to get the last or the first values how can I do that?
I need the next, prev, last, and first functions but I'm not sure about my first implementation.
Can anybody give me some advices of how start this.
I need solutions, advices. that duplicate means nothing.