Jdbc three ways to register drivers

About the driver package

Register the driver in jdbc, first import the corresponding package, such as mysql-connector-java-5.0.8-bin.jar. The driver package is a bridge between Java and a specific database, developed by the database vendor. Each database corresponds to a driver jar, and even each version of the database has its own version of the driver jar.

1: the first way

Class.forName("oracle.jdbc.driver.OracleDriver");//Load driver

Connection conn = DriverManager.getConnection

("jdbc:oracle:thin:@127.0.0.1:1521:XE", "system", "123456");

System.out.println("conn============>"+conn);

Jdbc three ways to register drivers

2: The second way

Driver driver = new oracle.jdbc.driver.OracleDriver();

DriverManager.registerDriver (driver); / / (JDBC2.0 can be omitted later, the default operation)

Connection conn = DriverManager.getConnection

("jdbc:oracle:thin:@127.0.0.1:1521:XE", "system", "123456");

System.out.println("conn============>"+conn);

Jdbc three ways to register drivers

3: The third way:

Add the full path of the oracle driver (ojdbc.jar) under the classpath (including the driver name itself)

Java -Djdbc.drivers=oracle.jdbc.driver.full pathname of the OracleDriver class

Jdbc three ways to register drivers

Some of the online said that the third is: System.setProperty ("jdbc.drivers", "com.mysql.jdbc.Driver"); After reading the DriverManager source code, it is found that the original DriverManager getConnection will be obtained from jdbc.drivers The jdbc driver is then registered to your own list of jdbc drivers. The third way is to register multiple drivers at once, with the middle: separate. For example, System.setProperty ("jdbc.drivers", "XXXDriver:XXXDriver:XXXDriver"); This will register three database drivers at a time.

OVNS 1500 Puffs Vape

OVNS 1500 Puffs Vape is so convenient, portable, and small volume, you just need to take them
out of your pocket and take a puff, feel the cloud of smoke, and the fragrance of fruit surrounding you. It's so great.
We are the distributor of the ovns & vapeak vape brand, we sell ovns disposable vape,ovns vape kit, ovns juul compatible refillable pod, and so on.
We are also China's leading manufacturer and supplier of Disposable Vapes puff bars, disposable vape kit, e-cigarette
vape pens, and e-cigarette kit, and we specialize in disposable vapes, e-cigarette vape pens, e-cigarette kits, etc.

ovns 1500 puffs vape bars,ovns 1500 puffs vape device,ovns 1500 puffs vape disposable,ovns 1500 puffs vape starter kit,ovns 1500 puffs vape pen

Ningbo Autrends International Trade Co.,Ltd. , https://www.vapee-cigarettes.com