Finalised ConnectionController and BuildDatabase

Completed the two class ConnectionController and BuildDatabase, Do not
touch from this point onwards.