Skip to content

Commit

Permalink
Load JDBC driver on website startup
Browse files Browse the repository at this point in the history
  • Loading branch information
Pyragon committed Apr 11, 2017
1 parent 42b7430 commit 42cad54
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 0 additions & 2 deletions run-mvn.sh

This file was deleted.

9 changes: 9 additions & 0 deletions src/com/cryo/db/DBConnectionManager.java
Expand Up @@ -23,6 +23,7 @@ public class DBConnectionManager {
private HashMap<Connection, DatabaseConnection> connections;

public DBConnectionManager() {
loadDriver();
init();
Website.LOADED = true;
}
Expand All @@ -31,6 +32,14 @@ public DatabaseConnection getConnection(Connection connection) {
return connections.get(connection);
}

public void loadDriver() {
try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
} catch (Exception e) {
e.printStackTrace();
}
}

public void init() {
connections = new HashMap<>();
connections.put(Connection.FORUMS, new ForumConnection());
Expand Down

0 comments on commit 42cad54

Please sign in to comment.