Why doesn't JDBC accept URLs instead of a URL string?- The URLs need to be converted to strings as there is no single universal protocol to treat the URLs as strings in JDBC databases.
- A protocol handler needs to be installed to treat them as java.net.URL.
- In Java 1.4, URL strings have a class called java.net.URI. But it cannot be used unless the URLs are converted to strings.
- The JDBC URL help to identify a database so that the right driver will recognize and establish a connection.
- The driver writers are used to determine the URL and the driver.
- Different drivers may use different schemes to name the databases.
- They allow the driver writers to encode the connection information.
- It allows a level of indirection.
|