DEVFYI - Developer Resource - FYI

Why doesn't JDBC accept URLs instead of a URL string?

JDBC Interview Questions and Answers


(Continued from previous question...)

Why doesn't JDBC accept URLs instead of a URL string?

In order for something to be a java.net.URL, a protocol handler needs to be installed. Since there is no one universal protocol for databases behind JDBC, the URLs are treated as strings. In Java 1.4, these URL strings have a class called java.net.URI. However, you still can't use a URI to load a JDBC driver, without converting it to a string.

(Continued on next question...)

Other Interview Questions