Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.gihtub.bysrhq.jdbc;
- import javax.sql.*;
- public class DbConnect {
- private final static Connection con;
- private final static String DB_URL = "jdbc:mysql://localhost:3306/testdb";
- private final static String DB_USERNAME = "root";
- private final static String DB_PASSWORD = "root";
- private final static OrangDAO orangDao;
- private final static OrangDAOImpl orangDAOImpl;
- /*
- * @param conn resource koneksi
- */
- public static getConnection() throws SQLException {
- if (conn == null)
- connection = DriverManager.getConnection(DB_URL, DB_USERNAME, DB_PASSWORD);
- return conn;
- }
- public static OrangDAO getOrangDao() throws SQLException {
- if (orangDao == null) {
- orangDao = new OrangDaoImpl(getConnection());
- return orangDao;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement