The DriverManager stores a list of Drivers, and when a request is made for a Driver, the DriverManager asks each Driver if it can handle the DB URL. The first Driver that says 'yes' is asked to provide the Connection.
Drivers have distinct URL syntax. When you call DriverManager.getConnection() the DriverManager looks through its list of registered drivers for one that can service a URL with the syntax you pass. In the example you have, assuming "oralcDBURL" were a valid Oracle driver syntax, the connection would come from the Oracle driver, the MySQL one is ignored.
[Och! Didn't type fast enough ] [ April 16, 2008: Message edited by: Paul Sturrock ]
The DriverManager source code is available with the JDK, see also the API, such as java.sql.Driver.acceptsURL(String url)
Joined: Dec 18, 2007
Paul Sturrock is it like this?
Connection is the interface present in the JDBC API. DriverManager.getConnection("OracleDBURl") will return connection object which is a vendow specific implementation. Using that connection object we can work on database using JDBC API.