Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package icecream;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.SQLException;
- public class DBConnectionManager {
- private static DBConnectionManager db = null;
- private static String user = "sa";
- private static String pass = "Suncoast$1";
- private String url;
- Connection conn;
- private DBConnectionManager() throws SQLException {
- url = "jdbc:sqlserver://localhost\\SQLEXPRESS;databaseName=period5;";
- conn = DriverManager.getConnection(url, user, pass);
- }
- static public DBConnectionManager getInstance() throws SQLException {
- if (db == null)
- db = new DBConnectionManager();
- return db;
- }
- public Connection getConnection() {
- return conn;
- }
- }
Add Comment
Please, Sign In to add comment