Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public DbConnection()
- {
- try
- {
- // This will load the MySQL driver, each DB has its own driver
- Class.forName("com.mysql.jdbc.Driver");
- // Setup the connection with the DB
- connection = DriverManager.getConnection("jdbc:mysql://url/team_staging?"
- + "user=X&password=X");
- }
- catch (ClassNotFoundException ex)
- {
- Logger.getLogger(DbConnection.class.getName()).log(Level.SEVERE, null, ex);
- }
- catch (SQLException ex)
- {
- Logger.getLogger(DbConnection.class.getName()).log(Level.SEVERE, null, ex);
- }
- }
- package persistence;
- public class DatabaseUtils {
- private DatabaseUtils() {}
- public static Connection getConnection(String driver, String url, String username, String password) throws Exception {
- Class.forName(driver);
- return DriverManager.getConnection(url, username, password);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement