Okay got it. I was thinking one level above maybe. Like if this code was using say jdbc type 3 driver to connect to multiple database types so in that case you need to pass the database name in the constructor and it will get you the required connection hence I thought of the first option. But I guess I was overthinking it because this question can be assumed to be using say jdbc type 4 driver and you are connected to one database maybe later you want to migrate to other database say from mysql to ms sql server then the correct answer is as given in this question.