TheObserver
Programmer
I'm working on a class that opens a ResourceBundle, pulls out a few key/values, and creates a jdbc DB connection from the info gathered.
I would like to make this class as DB independent as possible, meaning no special exceptions/methods/etc have to be added to add the ability to connect to new DBs as the need arises. My main concern is in regard to the DriverManager.getConnection(...) call. With MySQL, for instance, you only provide a single string that has the connection parameters, username, password, etc, all together. However, Oracle uses three strings - a connection parameter string, a username string, and a password string.
If I could use just one or the other (one string vs. three strings) for all getConnections, that would be ideal - I could just define a single string in the ResourceBundle file, or I define the connection/username/password strings and use the three parameter getConnection. Is this possible, or am I stuck with making special cases for each DB type?
I would like to make this class as DB independent as possible, meaning no special exceptions/methods/etc have to be added to add the ability to connect to new DBs as the need arises. My main concern is in regard to the DriverManager.getConnection(...) call. With MySQL, for instance, you only provide a single string that has the connection parameters, username, password, etc, all together. However, Oracle uses three strings - a connection parameter string, a username string, and a password string.
If I could use just one or the other (one string vs. three strings) for all getConnections, that would be ideal - I could just define a single string in the ResourceBundle file, or I define the connection/username/password strings and use the three parameter getConnection. Is this possible, or am I stuck with making special cases for each DB type?