SHARE
TWEET

Untitled

a guest Jun 25th, 2019 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public static void main(String[] args) {
  2.  
  3.     Connection cone = new Conexion().obtenerConexion();
  4.     String sql = "{call sp_listar_rol}";
  5.     if (cone != null) {
  6.         Rol r = new Rol();
  7.         Permiso p = new Permiso();
  8.         try {
  9.             CallableStatement cs = cone.prepareCall(sql);
  10.             cs.executeQuery();
  11.             ResultSet rs = cs.executeQuery();
  12.  
  13.             if (rs.next()) {
  14.                 int id = rs.getInt(1);
  15.                 String perfil = rs.getString(2);
  16.                 String desc = rs.getString(3);
  17.                 int permiso = rs.getInt(4);
  18.  
  19.                 p.setId(permiso);
  20.  
  21.                 r.setId(id);
  22.                 r.setPerfil(perfil);
  23.                 r.setDescripcion(desc);
  24.                 r.setId_permiso(p);
  25.  
  26.             }  
  27.             System.out.println(r.getPerfil());
  28.         } catch (SQLException ex) {
  29.             Logger.getLogger(test.class.getName()).log(Level.SEVERE, null, ex);
  30.         }
  31.     }
  32.  
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top