fix(server.js):Adjust connection options to handle Azure timeout bug

Also cleaned up database query code.