Detailed explanation of URL writing and summary of database connection

  • 2021-09-05 01:10:31
  • OfStack

Detailed explanation of URL writing and summary of database connection

URL for JDBC = protocol name + subprotocol name + data source name.

a. The protocol name is always "jdbc".
b. The subprotocol name is determined by the writer of the JDBC driver.
c. The data source name may also contain information such as user and password; This information can also be provided separately.

Several Common Database Connections

1-oracle-

Driver: Oracle. jdbc. driver. OracleDriver
URL: jdbc: oracle: thin: @ machine_name: port: dbname
Note: machine_name: The name of the machine where the database is located;
port: Port number, default is 1521

2-mysql-

Driver: com. MySQL. jdbc. Driver
URL: jdbc: mysql://machine_name: port/dbname
Note: machine_name: The name of the machine where the database is located;
port: Port number, default 3306

3-SQL Server-

Driver: com. microsoft. jdbc. sqlserver. SQLServerDriver
URL: jdbc: microsoft:// < machine_name > < :port > ;DatabaseName= < dbname >
Note: machine_name: The name of the machine where the database is located;
port: Port number, default is 1433

4-DB2-

Driver: com.ibm. db2.jdbc. app. DB2Driver
URL: jdbc: db2:// < machine_name > < :port > /dbname
Note: machine_name: The name of the machine where the database is located;
port: Port number, default is 5000

The above is the detailed explanation of the database connection URL writing and summary of the introduction, if you have questions, you can leave a message, or to the site community exchange discussion, thank you for reading, hope to help everyone, thank you for your support!


Related articles: