Advertisement
Guest User

Untitled

a guest
Nov 4th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.24 KB | None | 0 0
  1. private void OkButtonActionPerformed(java.awt.event.ActionEvent evt) {                                        
  2.         // TODO add your handling code here:
  3.         this.account=AccountField.getText().trim();
  4.         this.password=PasswordField.getText();
  5.         System.out.println("Oracle JDBC Connection ");
  6.         try {
  7.             Class.forName("oracle.jdbc.driver.OracleDriver");
  8.         } catch (ClassNotFoundException e) {
  9.             System.out.println("Where is your Oracle JDBC Driver?");
  10.             e.printStackTrace();
  11.                         this.status=false;
  12.             return;
  13.         }
  14.         System.out.println("Oracle JDBC Driver Registered!");
  15.         Connection connection = null;
  16.         try {
  17.             connection = DriverManager.getConnection(
  18.             "jdbc:oracle:thin:@192.168.2.2:1521:ELS", this.account,
  19.             this.password);
  20.         } catch (SQLException e) {
  21.             System.out.println("Connection Failed! Check output console");
  22.                         e.printStackTrace();
  23.                         JOptionPane.showMessageDialog(null, e.toString());
  24.                         this.status=false;
  25.             return;
  26.         }
  27.                 if(this.status) {
  28.                     System.out.println("true");
  29.                     setVisible(false);
  30.                 }
  31.                
  32. ;
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement