SHARE
TWEET

Untitled

a guest Aug 17th, 2018 86 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. String bd = "mibase";
  2.         String url = "jdbc:mysql://localhost:/3306"+bd;
  3.         String password = "admin";
  4.         String login = "root";
  5.         try {
  6.             Connection conn = null;
  7.             Class.forName("org.gjt.mm.mysql.Driver");
  8.             conn = DriverManager.getConnection(url, login, password);
  9.             if (conn != null)
  10.             {
  11.             JOptionPane.showMessageDialog(null,"Conexión a base de datos "+url+" ... Ok");
  12.             conn.close();
  13.             }
  14.         } catch (SQLException ex) {
  15.             Logger.getLogger(Prueba2.class.getName()).log(Level.SEVERE, null, ex);
  16.         } catch (ClassNotFoundException ex) {
  17.             Logger.getLogger(Prueba2.class.getName()).log(Level.SEVERE, null, ex);
  18.             JOptionPane.showMessageDialog
  19.             (null,"Hubo un problema al intentar conectarse con la base de datos"+ex.getMessage());
  20.         }
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top