1. JDBC URL concept
The JDBC URL provides a method of identifying a database that enables the corresponding driver to identify the database and establish a connection thereto. In fact, the driver programmer will determine what JDBC URL identifies a particular driver. Users don't have to care about how to form a JDBC URL, they only need to use the URL provided with the drivers used. JDBC's role is to provide some conventions, and the driver programmer should follow these conventions when constructing their JDBC URL.
(1) Since the JDBC URL should be used with a variety of different drivers, these conventions should be very flexible. First, they should allow different drivers to use different scenarios to name the database. For example, an ODBC sub protocol allows (but not required) URLs contain attribute values.
(2) The JDBC URL should allow the driver programmer to be encapsulated in it. This allows you to open the database connection with the applet of the database dialog, without requiring users to do any system management.
(3) The JDBC URL should allow some degree of indirectness. That is, the JDBC URL can point to the logical host or database name, and this logical host or database name will dynamically convert to the actual name by the network naming system. This allows the system to declare a particular host as part of the JDBC name. Network naming services (such as: DNS, NIS, and DCE) have multiple, and no restrictions on which naming service used.
2.JDBC URL format
The standard syntax of the JDBC URL is as follows. It consists of three parts, and each part is separated by colon.
JDBC:
The three parts of the JDBC URL can be decomposed as follows:
(1) JDBC - protocol. The protocol in the JDBC URL is always JDBC.
(2)
JDBC: ODBC: MyDatabase
(3)
/ / Host Name: Port / Sub Agreement