Guest User

Untitled

a guest
Oct 8th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. package com.vietanh.test.sql;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6.  
  7. public class Config {
  8.  
  9. public Connection getJDBCConnection() {
  10. String url = "jdbc:oracle:thin:@10.200.38.10:1521/TESTDB";
  11. String user = "ipa";
  12. String password = "TEST123";
  13. try {
  14. Class.forName("oracle.jdbc.driver.OracleDriver");
  15. return (Connection) DriverManager.getConnection(url, user, password);
  16. } catch (ClassNotFoundException e) {
  17. System.out.println("Driver not found!");
  18. // e.printStackTrace();
  19. } catch (SQLException e) {
  20. System.out.println("Access denied!");
  21. // e.printStackTrace();
  22. }
  23. return null;
  24. }
  25. }
Add Comment
Please, Sign In to add comment