Advertisement
Guest User

Untitled

a guest
Jan 17th, 2016
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. package controller;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.Driver;
  5. import java.sql.ResultSet;
  6. import java.sql.SQLException;
  7. import java.sql.Statement;
  8. import java.util.Properties;
  9.  
  10. public class DatabaseController {
  11.  
  12. public static Connection con;
  13. public static Statement stmt;
  14.  
  15. public static void main(String[] args) {
  16. // TODO Auto-generated method stub
  17.  
  18. }
  19.  
  20. public void openConnection () {
  21.  
  22. try {
  23. Driver d = new oracle.jdbc.driver.OracleDriver();
  24. Properties p = new Properties();
  25. p.put("user", "wpr");
  26. p.put("password", "1234");
  27.  
  28. con = d.connect("jdbc:oracle:thin:@localhost:1521:xe",p);
  29.  
  30. stmt = con.createStatement();
  31.  
  32. } catch (SQLException e) {
  33. // TODO Auto-generated catch block
  34. e.printStackTrace();
  35. }
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement