Hướng dẫn mysql connector-java version - phiên bản kết nối mysql-java

Configuration properties define how Connector/J will make a connection to a MySQL server. Unless otherwise noted, properties can be set for a DataSource object or for a Connection object.

Configuration properties can be set in one of the following ways:

  • Using the set*() methods on MySQL implementations of java.sql.DataSource (which is the preferred method when using implementations of java.sql.DataSource):

    • com.mysql.cj.jdbc.MysqlDataSource

    • com.mysql.cj.jdbc.MysqlConnectionPoolDataSource

  • As a key-value pair in the java.util.Properties instance passed to DriverManager.getConnection() or DataSource0

  • As a JDBC URL parameter in the URL given to DataSource1, DataSource2 or the MySQL implementations of the DataSource3 DataSource4 method. If you specify a configuration property in the URL without providing a value for it, nothing will be set; for example, adding DataSource5 alone to the URL does not make Connector/J use server-side prepared statements; you need to add DataSource6.

    Note

    If the mechanism you use to configure a JDBC URL is XML-based, use the XML character literal DataSource7 to separate configuration parameters, as the ampersand is a reserved character for XML.

The properties are listed by categories in the following tables and then in the subsections that follow. Click on a property name in the tables to see its full description in the subsections.

Table 6.1 Authentication Properties


Table 6.2 Connection Properties


Table 6.3 Session Properties



Table 6.5 Security Properties


Table 6.6 Statements Properties


Table 6.7 Prepared Statements Properties


Table 6.8 Result Sets Properties


Table 6.9 Metadata Properties


Table 6.10 BLOB/CLOB processing Properties


Table 6.11 Datetime types processing Properties


Table 6.12 High Availability and Clustering Properties


Table 6.13 Performance Extensions Properties


Table 6.14 Debugging/Profiling Properties


Table 6.15 Exceptions/Warnings Properties




Table 6.18 X Protocol and X DevAPI Properties


Here is some compatibility information for Connector/J 8.0:

  • JDBC versions: Connector/J 8.0 implements JDBC 4.2. While Connector/J 8.0 works with libraries of higher JDBC versions, it returns a DataSource8 for any calls of methods supported only by JDBC 4.3 and higher. : Connector/J 8.0 implements JDBC 4.2. While Connector/J 8.0 works with libraries of higher JDBC versions, it returns a DataSource8 for any calls of methods supported only by JDBC 4.3 and higher.

  • MySQL Server versions: Connector/J 8.0 supports MySQL 5.7 and 8.0. : Connector/J 8.0 supports MySQL 5.7 and 8.0.

  • JRE versions: Connector/J 8.0 supports JRE 8 or higher. : Connector/J 8.0 supports JRE 8 or higher.

  • JDK Required for Compilation: JDK 8.0 or higher is required for compiling Connector/J 8.0. Also, a customized JSSE provider might be required to use some later TLS versions and cipher suites when connecting to MySQL servers. For example, because Oracle's Java 8 releases before 8u261 were shipped with JSSE implementations that support TLS up to version 1.2 only, you need a customized JSSE implementation to use TLSv1.3 on those Java 8 platforms. Oracle Java 8u261 and above do support TLSv1.3, so no customized JSSE implementation is needed. : JDK 8.0 or higher is required for compiling Connector/J 8.0. Also, a customized JSSE provider might be required to use some later TLS versions and cipher suites when connecting to MySQL servers. For example, because Oracle's Java 8 releases before 8u261 were shipped with JSSE implementations that support TLS up to version 1.2 only, you need a customized JSSE implementation to use TLSv1.3 on those Java 8 platforms. Oracle Java 8u261 and above do support TLSv1.3, so no customized JSSE implementation is needed.


Dưới đây là một số thông tin tương thích cho Trình kết nối/J 8.0:

Nội dung chính ShowShow

  • Có được và sử dụng các gói phân phối nhị phân
  • Cấu hình CLASSPATH
  • Định cấu hình Trình kết nối/J cho máy chủ ứng dụng
  • Làm cách nào để tìm phiên bản kết nối MySQL?
  • Phiên bản kết nối MySQL là gì?
  • Tệp JAR kết nối MySQL ở đâu trong Linux?
  • Làm cách nào để cài đặt đầu nối Java MySQL?

  • Tải xuống và cài đặt Trình kết nối MySQL/j..: Connector/J 8.0 implements JDBC 4.2. While Connector/J 8.0 works with libraries of higher JDBC versions, it returns a DataSource8 for any calls of methods supported only by JDBC 4.3 and higher.

  • Tải xuống trình điều khiển MYSQL Connector/J tại Dev.MysQL.com ..: Connector/J 8.0 supports MySQL 5.7 and 8.0.

  • Cài đặt.Tệp JAR và lưu ý vị trí của nó để tham khảo trong tương lai.Ví dụ, cài đặt.Tệp JAR tại C: \ Files File \ MySQL \ MySQL Connector J \ MySQL-Connonector-Java-5.1.32-bin.cái lọ..: Connector/J 8.0 supports JRE 8 or higher.

  • Dưới đây là một số thông tin tương thích cho Trình kết nối/J 8.0:: JDK 8.0 or higher is required for compiling Connector/J 8.0. Also, a customized JSSE provider might be required to use some later TLS versions and cipher suites when connecting to MySQL servers. For example, because Oracle's Java 8 releases before 8u261 were shipped with JSSE implementations that support TLS up to version 1.2 only, you need a customized JSSE implementation to use TLSv1.3 on those Java 8 platforms. Oracle Java 8u261 and above do support TLSv1.3, so no customized JSSE implementation is needed.

Nội dung chính Show

Có được và sử dụng các gói phân phối nhị phân

Cấu hình CLASSPATH

Để biết ghi chú chi tiết các thay đổi trong mỗi bản phát hành của Trình kết nối/J 8.0, hãy xem Ghi chú phát hành MYSQL Connect/J 8.0.

Để biết thông tin pháp lý, bao gồm thông tin cấp phép, hãy xem lời nói đầu và thông báo pháp lý.

Để được giúp đỡ trong việc sử dụng MySQL, vui lòng truy cập diễn đàn MySQL, nơi bạn có thể thảo luận về các vấn đề của mình với người dùng MySQL khác.

Tài liệu được tạo vào ngày: 2022-10-03 (Sửa đổi: 74241)

Có được và sử dụng các gói phân phối nhị phân

Các loại gói phân phối nhị phân khác nhau cho Trình kết nối/J có sẵn từ trang Tải xuống Trình kết nối/J. Sau đây giải thích cách sử dụng từng loại gói để cài đặt trình kết nối/j.

Sử dụng Lưu trữ độc lập với nền tảng: Lưu trữ Connection1 hoặc Connection2 có sẵn để cài đặt Trình kết nối/J trên bất kỳ nền tảng nào. Sử dụng tiện ích đồ họa hoặc dòng lệnh thích hợp (ví dụ: TAR cho kho lưu trữ và Winzip Connection1 cho kho lưu trữ .zip), trích xuất kho lưu trữ JAR từ kho lưu trữ Connection1 hoặc Connection2 đến một vị trí phù hợp. Connection1 or Connection2 archives are available for installing Connector/J on any platform. Using the appropriate graphical or command-line utility (for example, tar for the Connection1 archive and WinZip for the .zip archive), extract the JAR archive from the Connection1 or Connection2 archive to a suitable location. Connection1 or Connection2 archives are available for installing Connector/J on any platform. Using the appropriate graphical or command-line utility (for example, tar for the Connection1 archive and WinZip for the .zip archive), extract the JAR archive from the Connection1 or Connection2 archive to a suitable location.

Ghi chú

Bởi vì có những tên tệp có khả năng dài trong phân phối, Trình kết nối/J Lưu trữ sử dụng định dạng Lưu trữ GNU TAR. Sử dụng GNU TAR hoặc một ứng dụng tương thích để giải nén biến thể Connection1 của phân phối.

Sử dụng các gói cho các hệ thống quản lý gói phần mềm trên các nền tảng Linux: các gói RPM và Debian có sẵn để cài đặt Trình kết nối/J trên một số phân phối Linux như Oracle Linux, Debian, Ubuntu, SUSE, v.v. Cài đặt các gói này bằng hệ thống quản lý gói phần mềm của hệ thống của bạn. RPM and Debian packages are available for installing Connector/J on a number of Linux distributions like Oracle Linux, Debian, Ubuntu, SUSE, and so on. Install these packages using your system's software package management system. RPM and Debian packages are available for installing Connector/J on a number of Linux distributions like Oracle Linux, Debian, Ubuntu, SUSE, and so on. Install these packages using your system's software package management system.

Cấu hình CLASSPATH

Khi ________ 9.jar đã được trích xuất từ ​​gói phân phối nhị phân đến đúng nơi, hoàn tất việc cài đặt trình điều khiển bằng cách đặt kho lưu trữ bình vào đường dẫn lớp Java của bạn, bằng cách thêm đường dẫn tệp đầy đủ của nó vào biến môi trường set*()2 của bạn hoặc bằng cách chỉ định trực tiếp tệp tệp của bạn Đường dẫn với công tắc dòng lệnh DataSource81 khi bắt đầu JVM.

Ví dụ: trên các nền tảng Linux, thêm trình điều khiển đầu nối/j vào set*()2 của bạn bằng một trong các biểu mẫu sau, tùy thuộc vào vỏ lệnh của bạn:

# Bourne-compatible shell (sh, ksh, bash, zsh):
$> export CLASSPATH=/path/mysql-connector-java-ver.jar:$CLASSPATH

# C shell (csh, tcsh):
$> setenv CLASSPATH /path/mysql-connector-java-ver.jar:$CLASSPATH

Bạn cũng có thể đặt biến môi trường set*()2 trong một tệp hồ sơ, hoặc cục bộ cho người dùng trong DataSource84, DataSource85 của người dùng hoặc tệp đăng nhập khác hoặc trên toàn cầu bằng cách chỉnh sửa tệp DataSource86 toàn cầu.

Đối với các nền tảng Windows, bạn đặt biến môi trường thông qua bảng điều khiển hệ thống.

Định cấu hình Trình kết nối/J cho máy chủ ứng dụng

Để sử dụng Trình kết nối MySQL/J với máy chủ ứng dụng như Glassfish hoặc Tomcat, hãy đọc tài liệu của nhà cung cấp để biết thông tin về cách định cấu hình thư viện lớp bên thứ ba, vì hầu hết các máy chủ ứng dụng đều bỏ qua biến môi trường set*()2. Đối với các ví dụ cấu hình cho một số máy chủ ứng dụng J2EE, xem Chương & NBSP; 8, kết nối gộp với đầu nối/j, phần & nbsp; 9.3, cấu hình cân bằng tải với đầu nối/j, và phần & nbsp; Tuy nhiên, nguồn có thẩm quyền cho thông tin cấu hình nhóm kết nối JDBC là tài liệu cho máy chủ ứng dụng của riêng bạn.

Nếu bạn đang phát triển Servlets hoặc JSPS và máy chủ ứng dụng của bạn tuân thủ J2EE, bạn có thể đặt tệp DataSource88 của trình điều khiển vào thư mục phụ DataSource89 của ứng dụng web của bạn, vì đây là vị trí tiêu chuẩn cho các thư viện lớp bên thứ ba trong các ứng dụng Web J2EE. Bạn cũng có thể sử dụng các lớp Connection10 hoặc Connection11 trong gói Connection12, nếu máy chủ ứng dụng J2EE của bạn hỗ trợ hoặc yêu cầu chúng. Giao diện Connection13 được triển khai bằng lớp Connection14, hỗ trợ các giao dịch phân tán XA. Các lớp Connection10 khác nhau hỗ trợ các tham số sau (thông qua các bộ đột biến tập tiêu chuẩn):

  • Connection16

  • Connection17

  • Connection18

  • Connection19

  • Connection20

Làm cách nào để tìm phiên bản kết nối MySQL?

Để kiểm tra phiên bản MySQL của bạn đang chạy, gõ và thực hiện mysql -v (lưu ý chữ v) trong dòng lệnh.Như bạn có thể thấy, phiên bản MySQL cho hệ thống này là 10,4.type and execute mysql -V (note the uppercase V) in the command line. As you can see, the MySQL version for this system is 10.4.type and execute mysql -V (note the uppercase V) in the command line. As you can see, the MySQL version for this system is 10.4.

Phiên bản kết nối MySQL là gì?

Trình kết nối MySQL/J là trình điều khiển JDBC chính thức cho MySQL.Trình kết nối MySQL/J 8.0 tương thích với tất cả các phiên bản MySQL bắt đầu bằng MySQL 5.6.MySQL Connector/J 8.0 is compatible with all MySQL versions starting with MySQL 5.6.MySQL Connector/J 8.0 is compatible with all MySQL versions starting with MySQL 5.6.

Tệp JAR kết nối MySQL ở đâu trong Linux?

Khi nó được cài đặt, bạn sẽ có tệp /usr/share/java/mysql.jar, đây là một liên kết phân tích gián tiếp cho tệp jar thực tế.Ngoài ra, cài đặt gói MySQL-APT-Config, cập nhật và bạn sẽ có thể cài đặt tất cả phần mềm MySQL hiện được hỗ trợ với APT./usr/share/java/mysql.jar , which is an indirect symlink to the actual jar file. Alternatively, install the mysql-apt-config package, update, and you'll be able to install all currently supported MySQL software with apt ./usr/share/java/mysql. jar , which is an indirect symlink to the actual jar file. Alternatively, install the mysql-apt-config package, update, and you'll be able to install all currently supported MySQL software with apt .

Làm cách nào để cài đặt đầu nối Java MySQL?

Tải xuống và cài đặt Trình kết nối MySQL/j...

Tải xuống trình điều khiển MYSQL Connector/J tại Dev.MysQL.com ..

Cài đặt.Tệp JAR và lưu ý vị trí của nó để tham khảo trong tương lai.Ví dụ, cài đặt.Tệp JAR tại C: \ Files File \ MySQL \ MySQL Connector J \ MySQL-Connonector-Java-5.1.32-bin.cái lọ..