Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
- try {
- Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
- Connection conexion = DriverManager.getConnection("jdbc:sqlserver://localhost:1434;databaseName=nombreBaseDeDatos;user=nombreUsuario;password=contraseña;");
- JOptionPane.showMessageDialog(this, "conexion satisfactoria");
- conexion.close();
- } catch (SQLException e) {
- JOptionPane.showMessageDialog(null, e.getMessage());
- } catch (ClassNotFoundException e) {
- JOptionPane.showMessageDialog(null, e.getMessage());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement