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 version 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
* 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 A.2.4, "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. Installing Connector/J
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 with either solution, you must
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 A.2.2, "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 un-archive 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 variableunder 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/to/mysql-connector-java-[version]-bin.j
ar:$CLASSPATH
Or with a Bourne-compatible shell (sh, ksh, bash):
export set CLASSPATH=/path/to/mysql-connector-java-[version]-bin.jar:
$CLASSPATH
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 A.5.2, "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
server is J2EE-compliant, you can put the driver's .jar file in
the WEB-INF/lib subdirec
没有合适的资源?快使用搜索试试~ 我知道了~
mysql-connector-java-3.1.14
共171个文件
java:131个
jar:12个
properties:7个
需积分: 10 19 下载量 195 浏览量
2009-01-21
17:26:16
上传
评论
收藏 7.68MB ZIP 举报
温馨提示
mysql-connector-java-3.1.14含源码、文档
资源推荐
资源详情
资源评论
收起资源包目录
mysql-connector-java-3.1.14 (171个子文件)
Tracer.aj 7KB
c3p0-LICENSE 26KB
CHANGES 109KB
COPYING 19KB
style.css 6KB
EXCEPTIONS-CONNECTOR-J 5KB
connector-j.html 173KB
LICENSE-AspectJ.html 16KB
aspectjtools.jar 5.22MB
mysql-connector-java-3.1.14-bin-g.jar 607KB
mysql-connector-java-3.1.14-bin.jar 448KB
c3p0-0.8.5-pre8.jar 391KB
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 224KB
DatabaseMetaData.java 217KB
MysqlIO.java 149KB
Connection.java 146KB
ResultSetRegressionTest.java 104KB
ConnectionProperties.java 100KB
PreparedStatement.java 95KB
StatementRegressionTest.java 95KB
UpdatableResultSet.java 71KB
ServerPreparedStatement.java 62KB
Statement.java 55KB
CallableStatement.java 53KB
TimeUtil.java 49KB
ConnectionRegressionTest.java 48KB
MetaDataRegressionTest.java 47KB
CallableStatementWrapper.java 43KB
ConnectionTest.java 39KB
StringUtils.java 35KB
StatementsTest.java 34KB
SQLError.java 32KB
StringRegressionTest.java 25KB
CallableStatementRegressionTest.java 24KB
Field.java 21KB
PreparedStatementWrapper.java 21KB
ConnectionWrapper.java 20KB
CharsetMapping.java 20KB
ResultSetMetaData.java 19KB
StatementWrapper.java 19KB
NonRegisteringDriver.java 18KB
MysqlErrorNumbers.java 17KB
MetadataTest.java 16KB
EscapeProcessor.java 15KB
ChannelBuffer.java 15KB
BlobRegressionTest.java 15KB
BlobFromLocator.java 14KB
MicroPerformanceRegressionTest.java 14KB
DateTest.java 14KB
ReplicationConnection.java 13KB
BaseTestCase.java 13KB
ByteArrayBuffer.java 13KB
PooledConnectionRegressionTest.java 12KB
CallableStatementTest.java 12KB
MysqlDefs.java 12KB
DataSourceRegressionTest.java 12KB
ProfilerEvent.java 12KB
LoadStorePerfTest.java 11KB
RowDataDynamic.java 10KB
UpdatabilityTest.java 9KB
MysqlDataSource.java 9KB
CharsetTests.java 9KB
NumbersRegressionTest.java 9KB
Security.java 9KB
ServerController.java 9KB
CompressedInputStream.java 8KB
RetrievalPerfTest.java 8KB
SubqueriesRegressionTest.java 8KB
Buffer.java 7KB
SingleByteCharsetConverter.java 7KB
BaseBugReport.java 7KB
Jdk14Logger.java 7KB
ReadAheadInputStream.java 7KB
BlobTest.java 7KB
StressRegressionTest.java 7KB
Clob.java 7KB
Util.java 7KB
StandardLogger.java 7KB
Blob.java 7KB
CommunicationsException.java 6KB
DataSourceTest.java 6KB
BasePerfTest.java 6KB
StandardSocketFactory.java 6KB
MysqlPooledConnection.java 6KB
RowData.java 6KB
TraversalTest.java 5KB
NamedPipeSocketFactory.java 5KB
Log4JLogger.java 5KB
RowDataStatic.java 4KB
EscapeTokenizer.java 4KB
LogUtils.java 4KB
NullLogger.java 4KB
共 171 条
- 1
- 2
资源评论
trwhoya
- 粉丝: 44
- 资源: 19
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功