1. 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-3.0 Type 4 driver, which means that is
pure Java, implements version 3.0 of the JDBC specification, and
communicates directly with the MySQL server using the MySQL
protocol.
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
1.1. Connector/J Versions
There are currently three versions of MySQL Connector/J available:
* 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.
* 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 5.0 provides support for all the functionality
offered by Connector/J 3.1 and includes distributed
transaction (XA) support.
The current recommended version for Connector/J is 5.0. This guide
covers all three connector versions, with specific notes given
where a setting applies to a specific option.
1.1.1. Java Versions Supported
MySQL Connector/J supports Java-2 JVMs, including:
* JDK 1.2.x (only for Connector/J 3.1.x or earlier)
* JDK 1.3.x
* JDK 1.4.x
* JDK 1.5.x
If you are building Connector/J from source using the source
distribution (see Section Section, "Installing from the
Development Source Tree") then you must use JDK 1.4.x or newer to
compiler the Connector package.
MySQL Connector/J does not support JDK-1.1.x or JDK-1.0.x.
Because of the implementation of java.sql.Savepoint, Connector/J
3.1.0 and newer will not run on JDKs older than 1.4 unless the
class verifier is turned off (by setting the -Xverify:none option
to the Java runtime). This is because the class verifier will try
to load the class definition for java.sql.Savepoint even though it
is not accessed by the driver unless you actually use savepoint
functionality.
Caching functionality provided by Connector/J 3.1.0 or newer is
also not available on JVMs older than 1.4.x, as it relies on
java.util.LinkedHashMap which was first available in JDK-1.4.0.
1.2. Connector/J Installation
You can install the Connector/J package using two methods, using
either the binary or source distribution. The binary distribution
provides the easiest methods for installation; the source
distribution enables you to customize your installation further.
With either solution, you must manually add the Connector/J
location to your Java CLASSPATH.
1.2.1. Installing Connector/J from a Binary Distribution
The easiest method of installation is to use the binary
distribution of the Connector/J package. The binary distribution
is available either as a Tar/Gzip or Zip file which you must
extract to a suitable location and then optionally make the
information about the package available by changing your CLASSPATH
(see Section Section, "Installing the Driver and Configuring the
CLASSPATH").
MySQL Connector/J is distributed as a .zip or .tar.gz archive
containing the sources, the class files, and the JAR archive named
mysql-connector-java-[version]-bin.jar, and starting with
Connector/J 3.1.8 a debug build of the driver in a file named
mysql-connector-java-[version]-bin-g.jar.
Starting with Connector/J 3.1.9, the .class files that constitute
the JAR files are only included as part of the driver JAR file.
You should not use the debug build of the driver unless instructed
to do so when reporting a problem ors bug to MySQL AB, as it is
not designed to be run in production environments, and will have
adverse performance impact when used. The debug binary also
depends on the Aspect/J runtime library, which is located in the
src/lib/aspectjrt.jar file that comes with the Connector/J
distribution.
You will need to use the appropriate graphical or command-line
utility to extract the distribution (for example, WinZip for the
.zip archive, and tar for the .tar.gz archive). Because there are
potentially long filenames in the distribution, we use the GNU tar
archive format. You will need to use GNU tar (or an application
that understands the GNU tar archive format) to unpack the .tar.gz
variant of the distribution.
1.2.2. Installing the Driver and Configuring the CLASSPATH
Once you have extracted the distribution archive, you can install
the driver by placing mysql-connector-java-[version]-bin.jar in
your classpath, either by adding the full path to it to your
CLASSPATH environment variable, or by directly specifying it with
the command line switch -cp when starting your JVM.
If you are going to use the driver with the JDBC DriverManager,
you would use com.mysql.jdbc.Driver as the class that implements
java.sql.Driver.
You can set the CLASSPATH environment variable under UNIX, Linux
or Mac OS X either locally for a user within their .profile,
.login or other login file. You can also set it globally by
editing the global /etc/profile file.
For example, under a C shell (csh, tcsh) you would add the
Connector/J driver to your CLASSPATH using the following:
shell> setenv CLASSPATH /path/mysql-connector-java-[ver]-bin.jar:$CLA
SSPATH
Or with a Bourne-compatible shell (sh, ksh, bash):
export set CLASSPATH=/path/mysql-connector-java-[ver]-bin.jar:$CLASSP
ATH
Within Windows 2000, Windows XP and Windows Server 2003, you must
set the environment variable through the System control panel.
If you want to use MySQL Connector/J with an application server
such as Tomcat or JBoss, you will have to read your vendor's
documentation for more information on how to configure third-party
class libraries, as most application servers ignore the CLASSPATH
environment variable. For configuration examples for some J2EE
application servers, see Section Section, "Using Connector/J with
J2EE and Other Java Frameworks." However, the authoritative source
for JDBC connection pool configuration information for your
particular application server is the documentation for that
application server.
If you are developing servlets or JSPs, and your application
没有合适的资源?快使用搜索试试~ 我知道了~
mysql-connector-java-5.1.0
共223个文件
java:178个
jar:11个
properties:7个
需积分: 3 52 下载量 201 浏览量
2009-03-27
23:45:38
上传
评论
收藏 15.42MB ZIP 举报
温馨提示
mysql-connector-java-5.1.0 MYSQL数据库驱动程序
资源推荐
资源详情
资源评论
收起资源包目录
mysql-connector-java-5.1.0 (223个子文件)
Tracer.aj 7KB
c3p0-LICENSE 26KB
CHANGES 134KB
COPYING 19KB
EXCEPTIONS-CONNECTOR-J 5KB
tb2-data.txt.gz 232KB
connector-j.html 199KB
LICENSE-AspectJ.html 16KB
aspectjtools.jar 5.22MB
mysql-connector-java-5.1.0-bin.jar 553KB
c3p0-0.9.1-pre6.jar 519KB
log4j-1.2.9.jar 344KB
ant-contrib.jar 190KB
junit.jar 118KB
jboss-common-jdbc-wrapper.jar 49KB
commons-logging.jar 37KB
aspectjrt.jar 34KB
jta-spec1_0_1.jar 8KB
jdbc2_0-stdext.jar 7KB
ResultSet.java 252KB
DatabaseMetaData.java 234KB
Connection.java 140KB
MysqlIO.java 135KB
ResultSetRegressionTest.java 127KB
PreparedStatement.java 121KB
ConnectionProperties.java 118KB
StatementRegressionTest.java 111KB
UpdatableResultSet.java 71KB
CallableStatementWrapper.java 69KB
ServerPreparedStatement.java 68KB
Statement.java 65KB
CallableStatement.java 64KB
MetaDataRegressionTest.java 57KB
ConnectionRegressionTest.java 56KB
TimeUtil.java 51KB
StatementsTest.java 50KB
SQLError.java 47KB
ConnectionTest.java 46KB
DatabaseMetaDataUsingInfoSchema.java 44KB
StringUtils.java 40KB
CallableStatementRegressionTest.java 36KB
PreparedStatementWrapper.java 32KB
MetadataTest.java 29KB
CharsetMapping.java 29KB
StringRegressionTest.java 28KB
StatementsTest.java 26KB
ConnectionWrapper.java 25KB
JDBC4MysqlSQLXML.java 25KB
Field.java 22KB
ResultSetMetaData.java 22KB
StatementWrapper.java 20KB
MysqlXAConnection.java 20KB
EscapeProcessor.java 20KB
JDBC4UpdatableResultSet.java 20KB
NonRegisteringDriver.java 18KB
MysqlErrorNumbers.java 17KB
BlobFromLocator.java 17KB
JDBC4ResultSet.java 17KB
MysqlDefs.java 16KB
BaseTestCase.java 16KB
Buffer.java 16KB
CallableStatementTest.java 15KB
MicroPerformanceRegressionTest.java 14KB
DateTest.java 14KB
DataSourceRegressionTest.java 14KB
ReplicationConnection.java 14KB
XATest.java 13KB
PooledConnectionRegressionTest.java 12KB
Blob.java 12KB
ProfilerEvent.java 12KB
RowDataDynamic.java 11KB
LoadStorePerfTest.java 11KB
CursorRowProvider.java 11KB
Util.java 11KB
BlobRegressionTest.java 11KB
MysqlDataSource.java 9KB
UpdatabilityTest.java 9KB
CharsetTests.java 9KB
JDBC4Connection.java 9KB
NumbersRegressionTest.java 9KB
Security.java 9KB
ServerController.java 9KB
ExportControlled.java 9KB
JDBC4DatabaseMetaDataUsingInfoSchema.java 8KB
JDBC4DatabaseMetaData.java 8KB
StandardSocketFactory.java 8KB
CompressedInputStream.java 8KB
Clob.java 8KB
RetrievalPerfTest.java 8KB
SubqueriesRegressionTest.java 8KB
ResultSetTest.java 7KB
SingleByteCharsetConverter.java 7KB
JDBC4CallableStatement.java 7KB
BaseBugReport.java 7KB
MysqlPooledConnection.java 7KB
Jdk14Logger.java 7KB
ReadAheadInputStream.java 7KB
StressRegressionTest.java 7KB
StandardLogger.java 7KB
BlobTest.java 7KB
共 223 条
- 1
- 2
- 3
资源评论
jinchengjie0702
- 粉丝: 1
- 资源: 69
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功