Detailed explanation and summary of the URL for database connection

Detailed explanation and summary of the URL for database connection

Detailed explanation and summary of the URL for database connection

JDBC URL = protocol name + sub-protocol 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 user and password information; 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, the 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 is 3306

3 —SQL Server—

Driver: com.microsoft.jdbc.sqlserver.SQLServerDriver
URL: jdbc:microsoft:sqlserver://<machine_name><:port>;DatabaseName=<dbname>
Note: machine_name: the name of the machine where the database is located;
port: port number, the 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, the default is 5000

The above is a detailed explanation of how to write the URL for database connection and a summary. If you have any questions, you can leave a message or discuss in the community of this site. Thank you for reading and I hope it can help you. Thank you for your support of this site!

You may also be interested in:
  • A brief analysis of using JDBC to operate MySQL requires adding Class.forName("com.mysql.jdbc.Driver")
  • About the setting of MySql link url parameters
  • How to use MySQL driverClassName and url

<<:  Three methods to modify the hostname of Centos7

>>:  React useMemo and useCallback usage scenarios

Recommend

How to use CSS styles and selectors

Three ways to use CSS in HTML: 1. Inline style: s...

Two methods of MySql comma concatenation string query

The following two functions are used in the same ...

Install .NET 6.0 in CentOS system using cloud server

.NET SDK Download Link https://dotnet.microsoft.c...

Analysis of Docker's method for creating local images

The so-called container actually creates a readab...

Solution to 404 Problem of Tomcat Installation in Docker

Find the containerID of tomcat and enter the toma...

Tomcat obtains the client domain name of Nginx reverse proxy

question After Nginx reverse proxy, the Tomcat ap...

In-depth analysis of the slow query problem of MySQL Sending data

Through an example, I shared with you the solutio...

How to install mysql database in deepin 2014 system

Deepin 2014 download and installation For downloa...

Advantages and Problems of XHTML CSS Website Design

XHTML is the standard website design language cur...

Detailed explanation of how to configure openGauss database in docker

For Windows User Using openGauss in Docker Pull t...

Solution to forgetting MySQL root password in MACOS

MySQL is a relational database management system ...