This is a rather basic but still interesting subject. Practically every project today needs a database. What would you say is the best way of creating and using a database connection class? It needs to be generic so that we can use one or several databases when necessary. The simple choice is using a global database variable. Enough said I think One alternative, that I like because of it's clean and simple design, is using a singleton class. This looks neat but there are issues. First of all, this is more or less the same as simply using a global variable, which is generally considered bad practice on OOP. It also limits us to one database which is usually just fine but it makes if less flexible. Another alternative is to pass a database reference around to each class that needs it. This is quite tedious, especially in a large system with complex structures and several levels of inheritance.
You can have a singleton database object that manages multiple databases using a config variables without using globals. I don't see why you need globals to start of with, you can have a settings property that will contain the settings, which is composed in the getInstance() method and you can have unlimited number of properties for all the database connections you need.
No, the globals was meant as another alternative separate from the singleton. However, to depend on a singleton is pretty much the same as using a global variable. Also, it makes testing more difficult. Dependency injection would perhaps make more sense?