Advertisement
juliomzt

depuradoV1TBLpaises

Jul 16th, 2012
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.95 KB | None | 0 0
  1. package ubicaciones.conexion.tablas;
  2.  
  3. import java.sql.CallableStatement;
  4. import java.sql.Connection;
  5. import java.sql.ResultSet;
  6. import java.sql.SQLException;
  7. import java.util.Vector;
  8. import ubicaciones.conexion.Conexion;
  9. import ubicaciones.conexion.tablas.util.Utils;
  10.  
  11. public class paises {
  12.    
  13.     Connection connMY = null;
  14.     private String host,bd,user,pass;
  15.    
  16.     private int idPais;
  17.    
  18.     public paises (String host, String bd, String user, String pass) {
  19.         this.host = host; this.bd = bd; this.user = user; this.pass = pass;
  20.     }
  21.    
  22.     public void setIdPais (int ip) {
  23.         this.idPais = ip;
  24.     }
  25.    
  26.     public final synchronized void insertPaises (String pais) throws ClassNotFoundException, SQLException {
  27.         Conexion c = new Conexion();
  28.         connMY = c.Conectar(host,bd,user,pass);
  29.         CallableStatement pa = connMY.prepareCall("{ call insertPaises(?) }");
  30.         pa.setString(1, pais);
  31.         ResultSet rs = pa.executeQuery();
  32.         rs.close();
  33.         pa.close();
  34.         connMY.close();
  35.     }
  36.    
  37.     public final synchronized void updatePaises (int idPais, String pais) throws ClassNotFoundException, SQLException {
  38.         Conexion c = new Conexion();
  39.         connMY = c.Conectar(host, bd, user, pass);
  40.         CallableStatement pa = connMY.prepareCall("{ call updatePaises(?,?)}");
  41.         pa.setInt(1, idPais);
  42.         pa.setString(2, pais);
  43.         ResultSet rs = pa.executeQuery();
  44.         rs.close();
  45.         pa.close();
  46.         connMY.close();
  47.     }
  48.    
  49.     public final synchronized void deletePaises (int idPais) throws ClassNotFoundException, SQLException {
  50.         Conexion c = new Conexion();
  51.         connMY = c.Conectar(host, bd, user, pass);
  52.         CallableStatement pa = connMY.prepareCall("{ call deletePaises(?,?) }");
  53.         pa.setInt(1, idPais);
  54.         ResultSet rs = pa.executeQuery();
  55.         rs.close();
  56.         pa.close();
  57.         connMY.close();
  58.     }
  59.    
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement