Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the types of Java connection DB2

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article will explain in detail what types of Java connection DB2 there are, and the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have a certain understanding of the relevant knowledge after reading this article.

There are several types of Java connection DB2

First: at present, IBM does not provide a JDBC driver for TYPE1.

The second type: type 2 driver: COM.ibm.DB2.jdbc.app.DB2Driver, which is also located in the package DB2java.zip. JDK must be able to access DB2's DB2jdbc.dll and so on.

Usage:

Class.forName (COM.ibm.DB2.jdbc.app.DB2Driver) .newInstance ()

Stringurl= "jdbc:DB2:sample"

Connectioncon=DriverManager.getConnection (url,user,password)

The TYPE2 driver enables Java applications to call DB2 through JDBC. The call to DB2JDBCtype2driver is converted to a Java local method. Java applications that use this driver must run on a DB2 client. JDBC requests to go to the DB2 server through this client.

Before you can use DB2JDBC application drivers to access DB2UDBforiSeries data sources or data sources in DB2forOS/390 or z/OS environments, you must install DB2ConnectVersion8.DB2JDBCtype2driver that supports most of the JDBC and SQLJ functions described in the JDBC1.2 specification, as well as some of the functions described in the JDBC2.0 specification.

There are several types of Java connection DB2

The third type: type 3 driver: COM.ibm.DB2.jdbc.net.DB2Driver, which is located in the package DB2java.zip.

Usage:

Class.forName (COM.ibm.DB2.jdbc.net.DB2Driver) .newInstance ()

The target connection DB2 system listens on the default port 6789 / need to start the DB2jstrt command on the database server to open the network port.

Stringurl= "jdbc:DB2://host:6789:SAMPLE"

Connectioncon=DriverManager.getConnection (url,user,password)

The fourth: type 4 driver: com.ibm.DB2.jcc.DB2Driver, which is located in the package DB2jcc.jar.

In this case: the database is encoded as utf-8, otherwise an error will be reported!

Usage:

Class.forName (com.ibm.DB2.jcc.DB2Driver) .newInstance ()

Stringurl= "jdbc:DB2://host:50000/SAMPLE"

Connectioncon=DriverManager.getConnection (url,user,password)

About what types of Java connection DB2 are shared here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report