@Override
    public Connection getConnection(boolean aRenewOldConnection) throws SQLException {
        if (this.pConnection == null || aRenewOldConnection == true) {
            //Prepare connection variables.
            String mUser = "";
            if (!"".equals(this.pConfiguration.getDatabaseUsername())) {
                mUser = "?user=" + this.pConfiguration.getDatabaseUsername();
            }
            
            String mPassword = "";
            if (!"".equals(this.pConfiguration.getDatabasePassword())) {
                mPassword = "&password=" + this.pConfiguration.getDatabasePassword();
            }
            
            String mPort = "";
            if (!"".equals(this.pConfiguration.getDatabasePort())) {
                mPort = ":" + this.pConfiguration.getDatabasePort();
            }
            
            //Setup the connection.
            String mConnectionString = "jdbc:mysql://" + this.pConfiguration.getDatabaseLocation() + mPort + "/" + this.pConfiguration.getDatabaseName() + mUser + mPassword;
            this.pConnection = DriverManager.getConnection(mConnectionString);
        }
        
        return this.pConnection;
    }