Advertisement
Guest User

Untitled

a guest
May 18th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.66 KB | None | 0 0
  1.     private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
  2.         try {
  3.             Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
  4.             Connection conexion = DriverManager.getConnection("jdbc:sqlserver://localhost:1434;databaseName=nombreBaseDeDatos;user=nombreUsuario;password=contraseña;");
  5.             JOptionPane.showMessageDialog(this, "conexion satisfactoria");
  6.             conexion.close();
  7.         } catch (SQLException e) {
  8.             JOptionPane.showMessageDialog(null, e.getMessage());
  9.         } catch (ClassNotFoundException e) {
  10.             JOptionPane.showMessageDialog(null, e.getMessage());
  11.         }
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement