daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Apr 27th, 2016 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.awt.HeadlessException;
  2. import java.sql.Connection;
  3. import java.sql.DriverManager;
  4. import java.sql.SQLException;
  5. import javax.swing.JOptionPane;
  6.  
  7. public class ConnectDb
  8. {  
  9.     public static Connection connectDb()
  10.     {      
  11.         try
  12.         {
  13.             Class.forName("oracle.jdbc.driver.OracleDriver");
  14.         }
  15.         catch (ClassNotFoundException e)
  16.         {
  17.             JOptionPane.showMessageDialog(null, e);
  18.         }
  19.         try
  20.         {          
  21.             Connection conn = DriverManager.getConnection("jdbc:oracle:thin:@127.0.0.1:1521:ORA2015","grX_login","hasło");
  22.             return conn;            
  23.         }
  24.         catch (SQLException | HeadlessException e)
  25.         {
  26.             JOptionPane.showMessageDialog(null, "Brak połaczenia z bazą danych!");
  27.         }    
  28.         return null;
  29.     }
  30. }
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