
23/09/2011, 17:54
|
 | | | Fecha de Ingreso: junio-2008 Ubicación: Medellin
Mensajes: 89
Antigüedad: 16 años, 9 meses Puntos: 4 | |
Respuesta: Cerrar conexion con JAVA Cita:
Iniciado por chuidiang Las llamadas a cerrarConexion() deberías ponerlas en los finally del try-catch. ¿Lo haces así?
Se bueno. Hola...
Mira tal cual estan....
Código:
public Vector consultarEmpresar(String valor) throws ConnectionException{
Vector empresas= new Vector();
try{
EmpresaDTO empresa;
PreparedStatement ps;
ResultSet rslt;
String sql = null;
conectar();
sql="select * from tabla";
ps = conexion.prepareStatement(sql);
ps.setString(1, "%"+valor+"%");
rslt = ps.executeQuery();
while (rslt.next()) {
empresa = new EmpresaDTO();
...
...
...
...
... }
/* Cierra conexiones establecidas */
ps.close();
cerrarConexion();
}catch(SQLException e){
e.printStackTrace();
}
return empresas;
}
__________________ Gabo Duk3
I.S |