Advertisement
Guest User

Untitled

a guest
Dec 2nd, 2016
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. package com.gihtub.bysrhq.jdbc;
  2.  
  3. import javax.sql.*;
  4.  
  5. public class DbConnect {
  6. private final static Connection con;
  7. private final static String DB_URL = "jdbc:mysql://localhost:3306/testdb";
  8. private final static String DB_USERNAME = "root";
  9. private final static String DB_PASSWORD = "root";
  10. private final static OrangDAO orangDao;
  11. private final static OrangDAOImpl orangDAOImpl;
  12.  
  13. /*
  14. * @param conn resource koneksi
  15. */
  16. public static getConnection() throws SQLException {
  17. if (conn == null)
  18. connection = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
  19.  
  20. return conn;
  21. }
  22.  
  23. public static OrangDAO getOrangDao() throws SQLException {
  24. if (orangDao == null) {
  25. orangDao = new OrangDaoImpl(getConnection());
  26.  
  27. return orangDao;
  28.  
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement