MySQL Connector/J
Copyright (c) 1997-2008 MySQL AB, 2009 Sun Microsystems, Inc. All
rights reserved. U.S. Government Rights - Commercial software.
Government users are subject to the Sun Microsystems, Inc.
standard license agreement and applicable provisions of the FAR
and its supplements. Use is subject to license terms. Sun, Sun
Microsystems, the Sun logo, Java, Solaris, StarOffice, MySQL
Enterprise Monitor 2.0, MySQL logo(tm) and MySQL(tm) are
trademarks or registered trademarks of Sun Microsystems, Inc. in
the U.S. and other countries. UNIX is a registered trademark in
the U.S. and other countries, exclusively licensed through X/Open
Company, Ltd.
Copyright (c) 1997-2008 MySQL AB, 2009 Sun Microsystems, Inc. Tous
droits r??serv??s. L'utilisation est soumise aux termes du contrat
de licence.Sun, Sun Microsystems, le logo Sun, Java, Solaris,
StarOffice, MySQL Enterprise Monitor 2.0, MySQL logo(tm) et
MySQL(tm) sont des marques de fabrique ou des marques d??pos??es de
Sun Microsystems, Inc. aux Etats-Unis et dans d'autres pays. UNIX
est une marque d??pos??e aux Etats-Unis et dans d'autres pays et
licenci??e exlusivement par X/Open Company, Ltd.
This documentation is NOT distributed under a GPL license. Use of
this documentation is subject to the following terms: You may
create a printed copy of this documentation solely for your own
personal use. Conversion to other formats is allowed as long as
the actual content is not altered or edited in any way. You shall
not publish or distribute this documentation in any form or on any
media, except if you distribute the documentation in a manner
similar to how Sun disseminates it (that is, electronically for
download on a Web site with the software) or on a CD-ROM or
similar medium, provided however that the documentation is
disseminated together with the software on the same medium. Any
other use, such as any dissemination of printed copies or use of
this documentation, in whole or in part, in another publication,
requires the prior written consent from an authorized
representative of Sun Microsystems, Inc. Sun Microsystems, Inc.
and MySQL AB reserve any and all rights to this documentation not
expressly granted above.
For more information on the terms of this license, for details on
how the MySQL documentation is built and produced, or if you are
interested in doing a translation, please contact the
Documentation Team (http://www.mysql.com/company/contact/).
For additional licensing information, including licenses for
libraries used by MySQL, see Preface, Notes, Licenses
(http://dev.mysql.com/doc/refman/5.0/en/preface.html).
If you want help with using MySQL, please visit either the MySQL
Forums (http://forums.mysql.com) or MySQL Mailing Lists
(http://lists.mysql.com) where you can discuss your issues with
other MySQL users.
For additional documentation on MySQL products, including
translations of the documentation into other languages, and
downloadable versions in variety of formats, including HTML, CHM,
and PDF formats, see MySQL Documentation Library
(http://dev.mysql.com/doc).
Abstract
This manual describes MySQL Connector/J, the JDBC implementation
for communicating with MySQL servers.
Document generated on: 2009-09-11 (revision: 16574)
_______________________________________________________
MySQL Connector/J
MySQL provides connectivity for client applications developed in
the Java programming language via a JDBC driver, which is called
MySQL Connector/J.
MySQL Connector/J is a JDBC Type 4 driver. Different versions are
available that are compatible with the JDBC 3.0 and JDBC 4.0
specifications. The Type 4 designation means that the driver is
pure-Java implementation of the MySQL protocol and does not rely
on the MySQL client libraries.
Although JDBC is useful by itself, we would hope that if you are
not familiar with JDBC that after reading the first few sections
of this manual, that you would avoid using naked JDBC for all but
the most trivial problems and consider using one of the popular
persistence frameworks such as Hibernate
(http://www.hibernate.org/), Spring's JDBC templates
(http://www.springframework.org/) or Ibatis SQL Maps
(http://ibatis.apache.org/) to do the majority of repetitive work
and heavier lifting that is sometimes required with JDBC.
This section is not designed to be a complete JDBC tutorial. If
you need more information about using JDBC you might be interested
in the following online tutorials that are more in-depth than the
information presented here:
* JDBC Basics
(http://java.sun.com/docs/books/tutorial/jdbc/basics/index.htm
l) --- A tutorial from Sun covering beginner topics in JDBC
* JDBC Short Course
(http://java.sun.com/developer/onlineTraining/Database/JDBCSho
rtCourse/index.html) --- A more in-depth tutorial from Sun and
JGuru
Key topics:
* For help with connection strings, connection options setting
up your connection through JDBC, see Section 4.1,
"Driver/Datasource Class Names, URL Syntax and Configuration
Properties for Connector/J."
* For tips on using Connector/J and JDBC with generic J2EE
toolkits, see Section 5.2, "Using Connector/J with J2EE and
Other Java Frameworks."
* Developers using the Tomcat server platform, see Section
5.2.2, "Using Connector/J with Tomcat."
* Developers using JBoss, see Section 5.2.3, "Using Connector/J
with JBoss."
* Developers using Spring, see Section 5.2.4, "Using Connector/J
with Spring."
MySQL Enterprise MySQL Enterprise subscribers will find more
information about using JDBC with MySQL in the Knowledge Base
articles about JDBC
(https://kb.mysql.com/search.php?cat=search&category=10). Access
to the MySQL Knowledge Base collection of articles is one of the
advantages of subscribing to MySQL Enterprise. For more
information, see
http://www.mysql.com/products/enterprise/advisors.html.
Chapter 1. Connector/J Versions
There are currently four versions of MySQL Connector/J available:
* Connector/J 5.1 is the Type 4 pure Java JDBC driver, which
conforms to the JDBC 3.0 and JDBC 4.0 specifications. It
provides compatibility with all the functionality of MySQL,
including 4.1, 5.0, 5.1, and 5.4. Connector/J 5.1 provides
ease of development features, including auto-registration with
the Driver Manager, standardized validity checks, categorized
SQLExceptions, support for the JDBC-4.0 XML processing, per
connection client information, NCHAR
(http://dev.mysql.com/doc/refman/5.0/en/char.html), NVARCHAR
(http://dev.mysql.com/doc/refman/5.0/en/char.html) and NCLOB
types. This release also includes all bug fixes up to and
including Connector/J 5.0.6.
* Connector/J 5.0 provides support for all the functionality
offered by Connector/J 3.1 and includes distributed
transaction (XA) support.
* Connector/J 3.1 was designed for connectivity to MySQL 4.1 and
MySQL 5.0 servers and provides support for all the
functionality in MySQL 5.0 except distributed transaction (XA)
support.
* Connector/J 3.0 provides core functionality and was designed
with connectivity to MySQL 3.x or MySQL 4.1 servers, although
it will provide basic compatibility with later versions of
MySQL. Connector/J 3.0 does not support server-side prepared
statements, and does not support any of the features in
versions of MySQL later than 4.1.
- 1
- 2
- 3
- 4
- 5
- 6
前往页