Connector/J (JDBC) Reference
2054
•
Example 20.5, “Connector/J: Registering output parameters”
•
Example 20.6, “Connector/J: Setting
CallableStatement
input parameters”
•
Example 20.7, “Connector/J: Retrieving results and output parameter values”
•
Example 20.8, “Connector/J: Retrieving
AUTO_INCREMENT
column values using
Statement.getGeneratedKeys()
”
•
Example 20.9, “Connector/J: Retrieving
AUTO_INCREMENT
column values using
SELECT
LAST_INSERT_ID()
”
•
Example 20.10, “Connector/J: Retrieving
AUTO_INCREMENT
column values in
Updatable
ResultSets
”
•
Example 20.11, “Connector/J: Using a connection pool with a J2EE application server”
•
Example 20.12, “Connector/J: Example of transaction with retry logic”
20.3.5. Connector/J (JDBC) Reference
This section of the manual contains reference material for MySQL Connector/J.
20.3.5.1. Driver/Datasource Class Names, URL Syntax and Configuration Properties for
Connector/J
The name of the class that implements
java.sql.Driver
in MySQL Connector/J is
com.mysql.jdbc.Driver
. The
org.gjt.mm.mysql.Driver
class name is also usable for
backward compatibility with MM.MySQL, the predecessor of Connector/J. Use this class name when
registering the driver, or when otherwise configuring software to use MySQL Connector/J.
JDBC URL Format
The JDBC URL format for MySQL Connector/J is as follows, with items in square brackets ([, ]) being
optional:
jdbc:mysql://[
host
][,
failoverhost
...][:
port
]/[
database
] »
[?
propertyName1
][=
propertyValue1
][&
propertyName2
][=
propertyValue2
]...
If the host name is not specified, it defaults to
127.0.0.1
. If the port is not specified, it defaults to
3306
, the default port number for MySQL servers.
jdbc:mysql://[
host
:
port
],[
host
:
port
].../[
database
] »
[?
propertyName1
][=
propertyValue1
][&
propertyName2
][=
propertyValue2
]...
Here is a sample connection URL:
jdbc:mysql://localhost:3306/sakila?profileSQL=true
IPv6 Connections
For IPv6 connections, use this alternative syntax to specify hosts in the URL,
address=(key=value)
. Supported keys are:
•
(protocol=tcp)
, or
(protocol=pipe)
for named pipes on Windows.
•
(path=path_to_pipe)
for named pipes.
•
(host=hostname)
for TCP connections.
•
(port=port_number)
for TCP connections.
For example:
jdbc:mysql://address=(protocol=tcp)(host=localhost)(port=3306)(user=test)/db
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...