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

HTML drag and drop function implementation code

Based on Vue The core idea of ​​this function is ...

Reasons why MySQL cancelled Query Cache

MySQL previously had a query cache, Query Cache. ...

Example of automatic stop effect after text scrolling

The effect is very simple, just copy the following...

MySQL Null can cause 5 problems (all fatal)

Table of contents 1. Count data is lost Solution ...

jQuery implements all selection and reverse selection operation case

This article shares the specific code of jQuery t...

Horizontal header menu implemented with CSS3

Result:Implementation Code html <nav class=&qu...

Solutions to invalid is Null segment judgment and IFNULL() failure in MySql

MySql Null field judgment and IFNULL failure proc...

Four solutions for using setTimeout in JS for loop

Table of contents Overview Solution 1: Closures S...

Vue3 implements CSS infinite seamless scrolling effect

This article example shares the specific code of ...

JavaScript to achieve slow motion animation effect

This article shares the specific code for JavaScr...

How to use MySQL common functions to process JSON

Official documentation: JSON Functions Name Descr...

Dynamic starry sky background implemented with CSS3

Result:Implementation Code html <link href=...

CSS Sticky Footer Several Implementations

What is "Sticky Footer" The so-called &...