Can I connect to 2 different database server in a single JDBC application?
Or is it possible to call Class.forNmae("url1"); for a type 1 database server, then Class.forName("url2); for a type 2 databse server, in my JDBC application.
You can connect to as many different databases as you need to. It doesn't matter of which type they are, and by which means you acquire them. Also, you can call the Class.forName() methods all before you make the connection.
By the way, a database server does not have a type, the JDBC driver for a database has a type.
Are you using a JDBC 2.0 driver? If so, obtain an InitialContext to obtain a DataSource by a JNDI lookup, and use the DataSource to get your Connection. You will need a DataSource for each DB.
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
a bit of art, as a gift, the permaculture playing cards