Advertisement
Guest User

Untitled

a guest
Nov 28th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. import java.sql.ResultSet;
  2. import java.sql.Statement;
  3. import java.sql.Connection;
  4. import java.sql.SQLException;
  5. import java.sql.DriverManager;
  6.  
  7.  
  8. public class GUI {
  9.  
  10. public static void main(String[] args) throws Exception {
  11.  
  12. Connection con = null; //connects to database//
  13.  
  14. Statement state = null; //allows to execute queries//
  15.  
  16. ResultSet set = null; //represents data from queries that statement has done//
  17.  
  18.  
  19.  
  20. try {
  21.  
  22. Class.forName("oracle.jdbc.driver.OracleDriver");
  23. con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:orcl","kmirshah","08076096");
  24. state = con.createStatement();
  25.  
  26. }
  27.  
  28. catch (SQLException exception) {
  29.  
  30. exception.printStackTrace();
  31.  
  32. }
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement