Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ubicaciones.conexion.tablas;
- import java.sql.CallableStatement;
- import java.sql.Connection;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.Vector;
- import ubicaciones.conexion.Conexion;
- import ubicaciones.conexion.tablas.util.Utils;
- public class paises {
- Connection connMY = null;
- private String host,bd,user,pass;
- private int idPais;
- public paises (String host, String bd, String user, String pass) {
- this.host = host; this.bd = bd; this.user = user; this.pass = pass;
- }
- public void setIdPais (int ip) {
- this.idPais = ip;
- }
- public final synchronized void insertPaises (String pais) throws ClassNotFoundException, SQLException {
- Conexion c = new Conexion();
- connMY = c.Conectar(host,bd,user,pass);
- CallableStatement pa = connMY.prepareCall("{ call insertPaises(?) }");
- pa.setString(1, pais);
- ResultSet rs = pa.executeQuery();
- rs.close();
- pa.close();
- connMY.close();
- }
- public final synchronized void updatePaises (int idPais, String pais) throws ClassNotFoundException, SQLException {
- Conexion c = new Conexion();
- connMY = c.Conectar(host, bd, user, pass);
- CallableStatement pa = connMY.prepareCall("{ call updatePaises(?,?)}");
- pa.setInt(1, idPais);
- pa.setString(2, pais);
- ResultSet rs = pa.executeQuery();
- rs.close();
- pa.close();
- connMY.close();
- }
- public final synchronized void deletePaises (int idPais) throws ClassNotFoundException, SQLException {
- Conexion c = new Conexion();
- connMY = c.Conectar(host, bd, user, pass);
- CallableStatement pa = connMY.prepareCall("{ call deletePaises(?,?) }");
- pa.setInt(1, idPais);
- ResultSet rs = pa.executeQuery();
- rs.close();
- pa.close();
- connMY.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement