element, in the file
sun-web.xml. The resource also has to be created in the web.xml
file, although the mapping of the resource to a JNDI name takes
place in the sun-web.xml file.
If you do not have this mapping set up correctly in the XML files
you will not be able to lookup the data source using a JNDI lookup
string such as:
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/MySQLDataSource");
You will still be able to access the data source directly using:
ds = (DataSource) ctx.lookup("jdbc/MySQLDataSource");
With the source files in place, in the correct directory
structure, you are ready to deploy the application:
1. In the navigation tree, navigate to Applications - the
Applications frame will be displayed. Click Deploy.
2. You can now deploy an application packaged into a single WAR
file from a remote client, or you can choose a packaged file
or directory that is locally accessible to the server. If you
are simply testing an application locally you can simply point
Glassfish at the directory that contains your application,
without needing to package the application into a WAR file.
3. Now select the application type from the Type drop-down
listbox, which in this example is Web application.
4. Click OK.
Now, when you navigate to the Applications frame, you will have
the option to Launch, Redeploy, or Restart your application. You
can test your application by clicking Launch. The application will
connection to the MySQL database and display the Name and
Population of countries in the Country table.
13.2 A Simple Servlet with Glassfish, Connector/J and MySQL
This section describes a simple servlet that can be used in the
Glassfish environment to access a MySQL database. As with the
previous section, this example assumes the sample database world
is installed.
The project is set up with the following directory structure:
index.html
WEB-INF
|
- web.xml
- sun-web.xml
- classes
|
- HelloWebServlet.java
- HelloWebServlet.class
The code for the servlet, located in HelloWebServlet.java, is as
follows:
import javax.servlet.http.*;
import javax.servlet.*;
import java.io.*;
import java.sql.*;
import javax.sql.*;
import javax.naming.*;
public class HelloWebServlet extends HttpServlet {
InitialContext ctx = null;
DataSource ds = null;
Connection conn = null;
PreparedStatement ps = null;
ResultSet rs = null;
String sql = "SELECT Name, Population FROM Country WHERE Name=?";
public void init () throws ServletException {
try {
ctx = new InitialContext();
ds = (DataSource) ctx.lookup("java:comp/env/jdbc/MySQLDataSourc
e");
conn = ds.getConnection();
ps = conn.prepareStatement(sql);
}
catch (SQLException se) {
System.out.println("SQLException: "+se.getMessage());
}
catch (NamingException ne) {
System.out.println("NamingException: "+ne.getMessage());
}
}
public void destroy () {
try {
if (rs != null)
rs.close();
if (ps != null)
ps.close();
if (conn != null)
conn.close();
if (ctx != null)
ctx.close();
}
catch (SQLException se) {
System.out.println("SQLException: "+se.getMessage());
}
catch (NamingException ne) {
System.out.println("NamingException: "+ne.getMessage());
}
}
public void doPost(HttpServletRequest req, HttpServletResponse resp
){
try {
String country_name = req.getParameter("country_name");
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
writer.println("");
writer.println("Country: "+country_name+"
");
ps.setString(1, country_name);
rs = ps.executeQuery();
if (!rs.next()){
writer.println("Country does not exist!
");
}
else {
rs.beforeFirst();
while(rs.next()) {
writer.println("Name: "+rs.getString("Name")+"
");
writer.println("Population: "+rs.getString("Population")
+"
");
}
}
writer.println("");
writer.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
public void doGet(HttpServletRequest req, HttpServletResponse resp)
{
try {
resp.setContentType("text/html");
PrintWriter writer = resp.getWriter();
writer.println("");
writer.println("Hello from servlet doGet()
");
writer.println("");
writer.close();
}
catch (Exception e) {
e.printStackTrace();
}
}
}
In the preceding code a basic doGet() method is implemented, but
is not used in the example. The code to establish the connection
with the database is as shown in the previous example, Section
13.1, "A Simple JSP Application with Glassfish, Connector/J and
MySQL," and is most conveniently located in the servlet init()
method. The corresponding freeing of resources is located in the
destroy method. The main functionality of the servlet is located
in the doPost() method. If the user enters nto the input form a
country name that can be located in the database, the population
of the country is returned. The code is invoked using a POST
action associated with the input form. The form is defined in the
file index.html:
HelloWebServlet
HelloWebServlet
Please enter country name:
The XML files web.xml and sun-web.xml are as for the example in
the preceding section, Section 13.1, "A Simple JSP Application
with Glassfish, Connector/J and MySQL," no additional changes are
required.
Whe compiling the Java source code, you will need to specify the
path to the file javaee.jar. On Windows, this can be done as
follows:
shell> javac -classpath c:\glassfishv3\glassfish\lib\javaee.jar Hello
WebServlet.java
Once the code is correctly located within its directory structure,
and compiled, the application can be deployed in Glassfish. This
is done in exactly the same way as described in the preceding
section, Section 13.1, "A Simple JSP Application with Glassfish,
Connector/J and MySQL."
Once deployed the application can be launched from within the
Glassfish Administration Console. Enter a country name such as
"England", and the application will return "Country does not
exist!". Enter "France", and the application will return a
population of 59225700.
Chapter 14 Using Connector/J with MySQL Fabric
MySQL Fabric is a system for managing a farm of MySQL servers (and
other components). Fabric provides an extensible and easy to use
system for managing a MySQL deployment for sharding and
high-availability.
MySQL Fabric is currently available in pre-production releases
only and is not fit for production. For more information on MySQL
Fabric, see MySQL Fabric
(http://dev.mysql.com/doc/mysql-utilities/1.4/en/fabric.html). For
instructions on how to use Connector/J with MySQL Fabric, see
Using Connector/J with MySQL Fabric
(http://dev.mysql.com/doc/mysql-utilities/1.4/en/connector-j-fabri
c.html).
Chapter 15 Troubleshooting Connector/J Applications
This section explains the symptoms and resolutions for the most
commonly encountered issues with applications using MySQL
Connector/J.
Questions
* 15.1: When I try to connect to the database with MySQL
Connector/J, I get the following exception:
SQLException: Server configuration denies access to data source
SQLState: 08001
VendorError: 0
What is going on? I can connect just fine with the MySQL
command-line client.
* 15.2: My application throws an SQLException 'No Suitable
Driver'. Why is this happening?
* 15.3: I'm trying to use MySQL Connector/J in an applet or
application and I get an exception similar to:
SQLException: Cannot connect to MySQL server on host:3306.
Is there a MySQL server running on the machine/port you
are trying to connect to?
(java.security.AccessControlException)
SQLState: 08S01
VendorError: 0
* 15.4: I have a servlet/application that works fine for a day,
and then stops working overnight
* 15.5: I'm trying to use JDBC 2.0 updatable result sets, and I
get an exception saying my result set is not updatable.
* 15.6: I cannot connect to the MySQL server using Connector/J,
and I'm sure the connection parameters are correct.
* 15.7: I am trying to connect to my MySQL server within my
application, but I get the following error and stack trace:
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv fail
ed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1392)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1414)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1926)
at com.mysql.jdbc.Connection.(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.j
ava:411)
* 15.8: My application is deployed through JBoss and I am using
transactions to handle the statements on the MySQL database.
Under heavy loads, I am getting an error and stack trace, but
these only occur after a fixed period of heavy activity.
* 15.9: When using gcj, a java.io.CharConversionException
exception is raised when working with certain character
sequences.
* 15.10: Updating a table that contains a primary key
(http://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_pri
mary_key) that is either FLOAT
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.h
tml) or compound primary key that uses FLOAT
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.h
tml) fails to update the table and raises an exception.
* 15.11: You get an ER_NET_PACKET_TOO_LARGE
(http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.
html#error_er_net_packet_too_large) exception, even though the
binary blob size you want to insert using JDBC is safely below
the max_allowed_packet
(http://dev.mysql.com/doc/refman/5.6/en/server-system-variable
s.html#sysvar_max_allowed_packet) size.
* 15.12: What should you do if you receive error messages
similar to the following: "Communications link failure - Last
packet sent to the server was X ms ago"?
* 15.13: Why does Connector/J not reconnect to MySQL and
re-issue the statement after a communication failure, instead
of throwing an Exception, even though I use the autoReconnect
connection string option?
* 15.14: How can I use 3-byte UTF8 with Connector/J?
* 15.15: How can I use 4-byte UTF8, utf8mb4 with Connector/J?
* 15.16: Using useServerPrepStmts=false and certain character
encodings can lead to corruption when inserting BLOBs. How can
this be avoided?
Questions and Answers
15.1: When I try to connect to the database with MySQL
Connector/J, I get the following exception:
SQLException: Server configuration denies access to data source
SQLState: 08001
VendorError: 0
What is going on? I can connect just fine with the MySQL
command-line client.
MySQL Connector/J must use TCP/IP sockets to connect to MySQL, as
Java does not support Unix Domain Sockets. Therefore, when MySQL
Connector/J connects to MySQL, the security manager in MySQL
server will use its grant tables to determine whether the
connection is permitted.
You must add the necessary security credentials to the MySQL
server for this to happen, using the GRANT
(http://dev.mysql.com/doc/refman/5.6/en/grant.html) statement to
your MySQL Server. See GRANT Syntax
(http://dev.mysql.com/doc/refman/5.6/en/grant.html), for more
information.
Note
Testing your connectivity with the mysql command-line client will
not work unless you add the "host" flag, and use something other
than localhost for the host. The mysql command-line client will
use Unix domain sockets if you use the special host name
localhost. If you are testing connectivity to localhost, use
127.0.0.1 as the host name instead.
Warning
Changing privileges and permissions improperly in MySQL can
potentially cause your server installation to not have optimal
security properties.
15.2: My application throws an SQLException 'No Suitable Driver'.
Why is this happening?
There are three possible causes for this error:
* The Connector/J driver is not in your CLASSPATH, see Chapter
3, "Connector/J Installation."
* The format of your connection URL is incorrect, or you are
referencing the wrong JDBC driver.
* When using DriverManager, the jdbc.drivers system property has
not been populated with the location of the Connector/J
driver.
15.3: I'm trying to use MySQL Connector/J in an applet or
application and I get an exception similar to:
SQLException: Cannot connect to MySQL server on host:3306.
Is there a MySQL server running on the machine/port you
are trying to connect to?
(java.security.AccessControlException)
SQLState: 08S01
VendorError: 0
Either you're running an Applet, your MySQL server has been
installed with the "skip-networking" option set, or your MySQL
server has a firewall sitting in front of it.
Applets can only make network connections back to the machine that
runs the web server that served the .class files for the applet.
This means that MySQL must run on the same machine (or you must
have some sort of port re-direction) for this to work. This also
means that you will not be able to test applets from your local
file system, you must always deploy them to a web server.
MySQL Connector/J can only communicate with MySQL using TCP/IP, as
Java does not support Unix domain sockets. TCP/IP communication
with MySQL might be affected if MySQL was started with the
"skip-networking" flag, or if it is firewalled.
If MySQL has been started with the "skip-networking" option set
(the Debian Linux package of MySQL server does this for example),
you need to comment it out in the file /etc/mysql/my.cnf or
/etc/my.cnf. Of course your my.cnf file might also exist in the
data directory of your MySQL server, or anywhere else (depending
on how MySQL was compiled for your system). Binaries created by us
always look in /etc/my.cnf and datadir/my.cnf. If your MySQL
server has been firewalled, you will need to have the firewall
configured to allow TCP/IP connections from the host where your
Java code is running to the MySQL server on the port that MySQL is
listening to (by default, 3306).
15.4: I have a servlet/application that works fine for a day, and
then stops working overnight
MySQL closes connections after 8 hours of inactivity. You either
need to use a connection pool that handles stale connections or
use the autoReconnect parameter (see Section 5.1,
"Driver/Datasource Class Names, URL Syntax and Configuration
Properties for Connector/J").
Also, catch SQLExceptions in your application and deal with them,
rather than propagating them all the way until your application
exits. This is just good programming practice. MySQL Connector/J
will set the SQLState (see java.sql.SQLException.getSQLState() in
your API docs) to 08S01 when it encounters network-connectivity
issues during the processing of a query. Attempt to reconnect to
MySQL at this point.
The following (simplistic) example shows what code that can handle
these exceptions might look like:
Example 15.1 Connector/J: Example of transaction with retry logic
public void doBusinessOp() throws SQLException {
Connection conn = null;
Statement stmt = null;
ResultSet rs = null;
//
// How many times do you want to retry the transaction
// (or at least _getting_ a connection)?
//
int retryCount = 5;
boolean transactionCompleted = false;
do {
try {
conn = getConnection(); // assume getting this from a
// javax.sql.DataSource, or the
// java.sql.DriverManager
conn.setAutoCommit(false);
//
// Okay, at this point, the 'retry-ability' of the
// transaction really depends on your application logic,
// whether or not you're using autocommit (in this case
// not), and whether you're using transactional storage
// engines
//
// For this example, we'll assume that it's _not_ safe
// to retry the entire transaction, so we set retry
// count to 0 at this point
//
// If you were using exclusively transaction-safe tables,
// or your application could recover from a connection go
ing
// bad in the middle of an operation, then you would not
// touch 'retryCount' here, and just let the loop repeat
// until retryCount == 0.
//
retryCount = 0;
stmt = conn.createStatement();
String query = "SELECT foo FROM bar ORDER BY baz";
rs = stmt.executeQuery(query);
while (rs.next()) {
}
rs.close();
rs = null;
stmt.close();
stmt = null;
conn.commit();
conn.close();
conn = null;
transactionCompleted = true;
} catch (SQLException sqlEx) {
//
// The two SQL states that are 'retry-able' are 08S01
// for a communications error, and 40001 for deadlock.
//
// Only retry if the error was due to a stale connection,
// communications problem or deadlock
//
String sqlState = sqlEx.getSQLState();
if ("08S01".equals(sqlState) || "40001".equals(sqlState))
{
retryCount -= 1;
} else {
retryCount = 0;
}
} finally {
if (rs != null) {
try {
rs.close();
} catch (SQLException sqlEx) {
// You'd probably want to log this...
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException sqlEx) {
// You'd probably want to log this as well...
}
}
if (conn != null) {
try {
//
// If we got here, and conn is not null, the
// transaction should be rolled back, as not
// all work has been done
try {
conn.rollback();
} finally {
conn.close();
}
} catch (SQLException sqlEx) {
//
// If we got an exception here, something
// pretty serious is going on, so we better
// pass it up the stack, rather than just
// logging it...
throw sqlEx;
}
}
}
} while (!transactionCompleted && (retryCount > 0));
}
Note
Use of the autoReconnect option is not recommended because there
is no safe method of reconnecting to the MySQL server without
risking some corruption of the connection state or database state
information. Instead, use a connection pool, which will enable
your application to connect to the MySQL server using an available
connection from the pool. The autoReconnect facility is
deprecated, and may be removed in a future release.
15.5: I'm trying to use JDBC 2.0 updatable result sets, and I get
an exception saying my result set is not updatable.
Because MySQL does not have row identifiers, MySQL Connector/J can
only update result sets that have come from queries on tables that
have at least one primary key
(http://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_primary
_key), the query must select every primary key column, and the
query can only span one table (that is, no joins). This is
outlined in the JDBC specification.
Note that this issue only occurs when using updatable result sets,
and is caused because Connector/J is unable to guarantee that it
can identify the correct rows within the result set to be updated
without having a unique reference to each row. There is no
requirement to have a unique field on a table if you are using
UPDATE (http://dev.mysql.com/doc/refman/5.6/en/update.html) or
DELETE (http://dev.mysql.com/doc/refman/5.6/en/delete.html)
statements on a table where you can individually specify the
criteria to be matched using a WHERE clause.
15.6: I cannot connect to the MySQL server using Connector/J, and
I'm sure the connection parameters are correct.
Make sure that the skip-networking
(http://dev.mysql.com/doc/refman/5.6/en/server-options.html#option
_mysqld_skip-networking) option has not been enabled on your
server. Connector/J must be able to communicate with your server
over TCP/IP; named sockets are not supported. Also ensure that you
are not filtering connections through a firewall or other network
security system. For more information, see Can't connect to
[local] MySQL server
(http://dev.mysql.com/doc/refman/5.6/en/can-not-connect-to-server.
html).
15.7: I am trying to connect to my MySQL server within my
application, but I get the following error and stack trace:
java.net.SocketException
MESSAGE: Software caused connection abort: recv failed
STACKTRACE:
java.net.SocketException: Software caused connection abort: recv fail
ed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
at com.mysql.jdbc.MysqlIO.readFully(MysqlIO.java:1392)
at com.mysql.jdbc.MysqlIO.readPacket(MysqlIO.java:1414)
at com.mysql.jdbc.MysqlIO.doHandshake(MysqlIO.java:625)
at com.mysql.jdbc.Connection.createNewIO(Connection.java:1926)
at com.mysql.jdbc.Connection.(Connection.java:452)
at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.j
ava:411)
The error probably indicates that you are using a older version of
the Connector/J JDBC driver (2.0.14 or 3.0.x) and you are trying
to connect to a MySQL server with version 4.1x or newer. The older
drivers are not compatible with 4.1 or newer of MySQL as they do
not support the newer authentication mechanisms.
It is likely that the older version of the Connector/J driver
exists within your application directory or your CLASSPATH
includes the older Connector/J package.
15.8: My application is deployed through JBoss and I am using
transactions to handle the statements on the MySQL database. Under
heavy loads, I am getting an error and stack trace, but these only
occur after a fixed period of heavy activity.
This is a JBoss, not Connector/J, issue and is connected to the
use of transactions. Under heavy loads the time taken for
transactions to complete can increase, and the error is caused
because you have exceeded the predefined timeout.
You can increase the timeout value by setting the
TransactionTimeout attribute to the TransactionManagerService
within the /conf/jboss-service.xml file (pre-4.0.3) or
/deploy/jta-service.xml for JBoss 4.0.3 or later. See
TransactionTimeout
(http://wiki.jboss.org/wiki/Wiki.jsp?page=TransactionTimeout)
within the JBoss wiki for more information.
15.9: When using gcj, a java.io.CharConversionException exception
is raised when working with certain character sequences.
This is a known issue with gcj which raises an exception when it
reaches an unknown character or one it cannot convert. Add
useJvmCharsetConverters=true to your connection string to force
character conversion outside of the gcj libraries, or try a
different JDK.
15.10: Updating a table that contains a primary key
(http://dev.mysql.com/doc/refman/5.6/en/glossary.html#glos_primary
_key) that is either FLOAT
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.html)
or compound primary key that uses FLOAT
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.html)
fails to update the table and raises an exception.
Connector/J adds conditions to the WHERE clause during an UPDATE
(http://dev.mysql.com/doc/refman/5.6/en/update.html) to check the
old values of the primary key. If there is no match, then
Connector/J considers this a failure condition and raises an
exception.
The problem is that rounding differences between supplied values
and the values stored in the database may mean that the values
never match, and hence the update fails. The issue will affect all
queries, not just those from Connector/J.
To prevent this issue, use a primary key that does not use FLOAT
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.html)
. If you have to use a floating point column in your primary key,
use DOUBLE
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.html)
or DECIMAL
(http://dev.mysql.com/doc/refman/5.6/en/fixed-point-types.html)
types in place of FLOAT
(http://dev.mysql.com/doc/refman/5.6/en/floating-point-types.html)
.
15.11: You get an ER_NET_PACKET_TOO_LARGE
(http://dev.mysql.com/doc/refman/5.6/en/error-messages-server.html
#error_er_net_packet_too_large) exception, even though the binary
blob size you want to insert using JDBC is safely below the
max_allowed_packet
(http://dev.mysql.com/doc/refman/5.6/en/server-system-variables.ht
ml#sysvar_max_allowed_packet) size.
This is because the hexEscapeBlock() method in
com.mysql.jdbc.PreparedStatement.streamToBytes() may almost double
the size of your data.
15.12: What should you do if you receive error messages similar to
the following: "Communications link failure - Last packet sent to
the server was X ms ago"?
Generally speaking, this error suggests that the network
connection has been closed. There can be several root causes:
* Firewalls or routers may clamp down on idle connections (the
MySQL client/server protocol does not ping).
* The MySQL Server may be closing idle connections that exceed
the wait_timeout or interactive_timeout threshold.
To help troubleshoot these issues, the following tips can be used.
If a recent (5.1.13+) version of Connector/J is used, you will see
an improved level of information compared to earlier versions.
Older versions simply display the last time a packet was sent to
the server, which is frequently 0 ms ago. This is of limited use,
as it may be that a packet was just sent, while a packet from the
server has not been received for several hours. Knowing the period
of time since Connector/J last received a packet from the server
is useful information, so if this is not displayed in your
exception message, it is recommended that you update Connector/J.
Further, if the time a packet was last sent/received exceeds the
wait_timeout or interactive_timeout threshold, this is noted in
the exception message.
Although network connections can be volatile, the following can be
helpful in avoiding problems:
* Ensure connections are valid when used from the connection
pool. Use a query that starts with /* ping */ to execute a
lightweight ping instead of full query. Note, the syntax of
the ping needs to be exactly as specified here.
* Minimize the duration a connection object is left idle while
other application logic is executed.
* Explicitly validate the connection before using it if the
connection has been left idle for an extended period of time.
* Ensure that wait_timeout and interactive_timeout are set
sufficiently high.
* Ensure that tcpKeepalive is enabled.
* Ensure that any configurable firewall or router timeout
settings allow for the maximum expected connection idle time.
Note
Do not expect to be able to reuse a connection without problems,
if it has being lying idle for a period. If a connection is to be
reused after being idle for any length of time, ensure that you
explicitly test it before reusing it.
15.13: Why does Connector/J not reconnect to MySQL and re-issue
the statement after a communication failure, instead of throwing
an Exception, even though I use the autoReconnect connection
string option?
There are several reasons for this. The first is transactional
integrity. The MySQL Reference Manual states that "there is no
safe method of reconnecting to the MySQL server without risking
some corruption of the connection state or database state
information". Consider the following series of statements for
example:
conn.createStatement().execute(
"UPDATE checking_account SET balance = balance - 1000.00 WHERE cust
omer='Smith'");
conn.createStatement().execute(
"UPDATE savings_account SET balance = balance + 1000.00 WHERE custo
mer='Smith'");
conn.commit();
Consider the case where the connection to the server fails after
the UPDATE to checking_account. If no exception is thrown, and the
application never learns about the problem, it will continue
executing. However, the server did not commit the first
transaction in this case, so that will get rolled back. But
execution continues with the next transaction, and increases the
savings_account balance by 1000. The application did not receive
an exception, so it continued regardless, eventually committing
the second transaction, as the commit only applies to the changes
made in the new connection. Rather than a transfer taking place, a
deposit was made in this example.
Note that running with autocommit enabled does not solve this
problem. When Connector/J encounters a communication problem,
there is no means to determine whether the server processed the
currently executing statement or not. The following theoretical
states are equally possible:
* The server never received the statement, and therefore no
related processing occurred on the server.
* The server received the statement, executed it in full, but
the response was not received by the client.
If you are running with autocommit enabled, it is not possible to
guarantee the state of data on the server when a communication
exception is encountered. The statement may have reached the
server, or it may not. All you know is that communication failed
at some point, before the client received confirmation (or data)
from the server. This does not only affect autocommit statements
though. If the communication problem occurred during
Connection.commit(), the question arises of whether the
transaction was committed on the server before the communication
failed, or whether the server received the commit request at all.
The second reason for the generation of exceptions is that
transaction-scoped contextual data may be vulnerable, for example:
* Temporary tables.
* User-defined variables.
* Server-side prepared statements.
These items are lost when a connection fails, and if the
connection silently reconnects without generating an exception,
this could be detrimental to the correct execution of your
application.
In summary, communication errors generate conditions that may well
be unsafe for Connector/J to simply ignore by silently
reconnecting. It is necessary for the application to be notified.
It is then for the application developer to decide how to proceed
in the event of connection errors and failures.
15.14: How can I use 3-byte UTF8 with Connector/J?
To use 3-byte UTF8 with Connector/J set characterEncoding=utf8 and
set useUnicode=true in the connection string.
15.15: How can I use 4-byte UTF8, utf8mb4 with Connector/J?
To use 4-byte UTF8 with Connector/J configure the MySQL server
with character_set_server=utf8mb4. Connector/J will then use that
setting as long as characterEncoding has not been set in the
connection string. This is equivalent to autodetection of the
character set.
15.16: Using useServerPrepStmts=false and certain character
encodings can lead to corruption when inserting BLOBs. How can
this be avoided?
When using certain character encodings, such as SJIS, CP932, and
BIG5, it is possible that BLOB data contains characters that can
be interpreted as control characters, for example, backslash, '\'.
This can lead to corrupted data when inserting BLOBs into the
database. There are two things that need to be done to avoid this:
1. Set the connection string option useServerPrepStmts to true.
2. Set SQL_MODE to NO_BACKSLASH_ESCAPES.
Chapter 16 Known Issues and Limitations
The following are some known issues and limitations for MySQL
Connector/J:
* When Connector/J retrieves timestamps for a daylight saving
time (DST) switch day using the getTimeStamp() method on the
result set, some of the returned values might be wrong. The
errors can be avoided by using the following connection
options when connecting to a database:
useTimezone=true
useLegacyDatetimeCode=false
serverTimezone=UTC
Chapter 17 Connector/J Support
17.1 Connector/J Community Support
Oracle provides assistance to the user community by means of its
mailing lists. For Connector/J related issues, you can get help
from experienced users by using the MySQL and Java mailing list.
Archives and subscription information is available online at
http://lists.mysql.com/java.
For information about subscribing to MySQL mailing lists or to
browse list archives, visit http://lists.mysql.com/. See MySQL
Mailing Lists
(http://dev.mysql.com/doc/refman/5.6/en/mailing-lists.html).
Community support from experienced users is also available through
the JDBC Forum (http://forums.mysql.com/list.php?39). You may also
find help from other users in the other MySQL Forums, located at
http://forums.mysql.com. See MySQL Community Support at the MySQL
Forums (http://dev.mysql.com/doc/refman/5.6/en/forums.html).
17.2 How to Report Connector/J Bugs or Problems
The normal place to report bugs is http://bugs.mysql.com/, which
is the address for our bugs database. This database is public, and
can be browsed and searched by anyone. If you log in to the
system, you will also be able to enter new reports.
If you find a sensitive security bug in MySQL Server, please let
us know immediately by sending an email message to
secalert_us@oracle.com. Exception: Support customers should report
all problems, including security bugs, to Oracle Support at
http://support.oracle.com/.
Writing a good bug report takes patience, but doing it right the
first time saves time both for us and for yourself. A good bug
report, containing a full test case for the bug, makes it very
likely that we will fix the bug in the next release.
This section will help you write your report correctly so that you
do not waste your time doing things that may not help us much or
at all.
If you have a repeatable bug report, please report it to the bugs
database at http://bugs.mysql.com/. Any bug that we are able to
repeat has a high chance of being fixed in the next MySQL release.
To report other problems, you can use one of the MySQL mailing
lists.
Remember that it is possible for us to respond to a message
containing too much information, but not to one containing too
little. People often omit facts because they think they know the
cause of a problem and assume that some details do not matter.
A good principle is this: If you are in doubt about stating
something, state it. It is faster and less troublesome to write a
couple more lines in your report than to wait longer for the
answer if we must ask you to provide information that was missing
from the initial report.
The most common errors made in bug reports are (a) not including
the version number of Connector/J or MySQL used, and (b) not fully
describing the platform on which Connector/J is installed
(including the JVM version, and the platform type and version
number that MySQL itself is installed on).
This is highly relevant information, and in 99 cases out of 100,
the bug report is useless without it. Very often we get questions
like, "Why doesn't this work for me?" Then we find that the
feature requested wasn't implemented in that MySQL version, or
that a bug described in a report has already been fixed in newer
MySQL versions.
Sometimes the error is platform-dependent; in such cases, it is
next to impossible for us to fix anything without knowing the
operating system and the version number of the platform.
If at all possible, create a repeatable, standalone testcase that
doesn't involve any third-party classes.
To streamline this process, we ship a base class for testcases
with Connector/J, named 'com.mysql.jdbc.util.BaseBugReport'. To
create a testcase for Connector/J using this class, create your
own class that inherits from com.mysql.jdbc.util.BaseBugReport and
override the methods setUp(), tearDown() and runTest().
In the setUp() method, create code that creates your tables, and
populates them with any data needed to demonstrate the bug.
In the runTest() method, create code that demonstrates the bug
using the tables and data you created in the setUp method.
In the tearDown() method, drop any tables you created in the
setUp() method.
In any of the above three methods, use one of the variants of the
getConnection() method to create a JDBC connection to MySQL:
* getConnection() - Provides a connection to the JDBC URL
specified in getUrl(). If a connection already exists, that
connection is returned, otherwise a new connection is created.
* getNewConnection() - Use this if you need to get a new
connection for your bug report (that is, there is more than
one connection involved).
* getConnection(String url) - Returns a connection using the
given URL.
* getConnection(String url, Properties props) - Returns a
connection using the given URL and properties.
If you need to use a JDBC URL that is different from
'jdbc:mysql:///test', override the method getUrl() as well.
Use the assertTrue(boolean expression) and assertTrue(String
failureMessage, boolean expression) methods to create conditions
that must be met in your testcase demonstrating the behavior you
are expecting (vs. the behavior you are observing, which is why
you are most likely filing a bug report).
Finally, create a main() method that creates a new instance of
your testcase, and calls the run method:
public static void main(String[] args) throws Exception {
new MyBugReport().run();
}
Once you have finished your testcase, and have verified that it
demonstrates the bug you are reporting, upload it with your bug
report to http://bugs.mysql.com/.
Appendix A Licenses for Third-Party Components
MySQL Connector/J
* Section A.1, "Ant-Contrib License"
* Section A.2, "c3p0 JDBC Library License"
* Section A.3, "GNU Lesser General Public License Version 2.1,
February 1999"
* Section A.4, "jboss-common-jdbc-wrapper.jar License"
* Section A.5, "NanoXML License"
* Section A.6, "rox.jar License"
* Section A.7, "Simple Logging Facade for Java (SLF4J) License"
A.1 Ant-Contrib License
The following software may be included in this product up to
version 5.1.26: Ant-Contrib
Ant-Contrib
Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
Licensed under the Apache 1.1 License Agreement, a copy of which is r
eproduced below.
The Apache Software License, Version 1.1
Copyright (c) 2001-2003 Ant-Contrib project. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The end-user documentation included with the redistribution, if
any, must include the following acknowlegement:
"This product includes software developed by the
Ant-Contrib project (http://sourceforge.net/projects/ant-cont
rib)."
Alternately, this acknowlegement may appear in the software itsel
f,
if and wherever such third-party acknowlegements normally appear.
4. The name Ant-Contrib must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact
ant-contrib-developers@lists.sourceforge.net.
5. Products derived from this software may not be called "Ant-Contri
b"
nor may "Ant-Contrib" appear in their names without prior written
permission of the Ant-Contrib project.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE ANT-CONTRIB PROJECT OR ITS
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
A.2 c3p0 JDBC Library License
You are receiving a copy of c3p0-0.9.1-pre6.jar in both source and
object code in the following /src/lib/c3p0-0.9.1-pre6.jar. The
terms of the Oracle license do NOT apply to c3p0-0.9.1-pre6.jar;
it is licensed under the following license, separately from the
Oracle programs you receive. If you do not wish to install this
library, you may remove the file /src/lib/c3p0-0.9.1-pre6.jar, but
the Oracle program might not operate properly or at all without
the library.
This component is licensed under Section A.3, "GNU Lesser General
Public License Version 2.1, February 1999."
A.3 GNU Lesser General Public License Version 2.1, February 1999
The following applies to all products licensed under the
GNU Lesser General Public License, Version 2.1: You may
not use the identified files except in compliance with
the GNU Lesser General Public License, Version 2.1 (the
"License"). You may obtain a copy of the License at
http://www.gnu.org/licenses/lgpl-2.1.html. A copy of the
license is also reproduced below. Unless required by
applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
or implied. See the License for the specific language governing
permissions and limitations under the License.
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also count
s
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whethe
r
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations bel
ow.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure tha
t
you have the freedom to distribute copies of free software (and charg
e
for this service if you wish); that you receive source code or can ge
t
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender thes
e
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether grati
s
or for a fee, you must give the recipients all the rights that we gav
e
you. You must make sure that they, too, receive or can get the sourc
e
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence o
f
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or usin
g
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantage
s
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certai
n
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it
becomes a de-facto standard. To achieve this, non-free programs
must be allowed to use the library. A more frequent case is that
a free library does the same job as widely used non-free libraries.
In this case, there is little to gain by limiting the free library
to free software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of th
e
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter mus
t
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms o
f
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translate
d
straightforwardly into another language. (Hereinafter, translation i
s
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code mean
s
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control
compilation and installation of the library.
Activities other than copying, distribution and modification are no
t
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output fro
m
such a program is covered only if its contents constitute a work base
d
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for
a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or
a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that
,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Librar
y
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Publi
c
License instead of this License to a given copy of the Library. To d
o
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2
,
instead of to this License. (If a newer version than version 2 of th
e
ordinary GNU General Public License has appeared, then you can specif
y
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, whic
h
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled o
r
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header fil
e
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivativ
e
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do on
e
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in th
e
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system
,
rather than copying library functions into the executable, and (2
)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with
.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the abov
e
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you canno
t
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combine
d
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies
,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on th
e
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Librar
y
subject to these terms and conditions. You may not impose any furthe
r
restrictions on the recipients' exercise of the rights granted herein
.
You are not responsible for enforcing compliance by third parties wit
h
this License.
11. If, as a consequence of a court judgment or allegation of paten
t
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do no
t
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under thi
s
License and any other pertinent obligations, then as a consequence yo
u
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library b
y
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended
to apply, and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willin
g
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Librar
y
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published b
y
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free statu
s
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUC
H
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms
of the ordinary General Public License).
To apply these terms, attach the following notices to the library.
It is safest to attach them to the start of each source file to most
effectively convey the exclusion of warranty; and each file should
have at least the "copyright" line and a pointer to where the full
notice is found.
Copyright (C)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version
.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Softwa
re
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA
Also add information on how to contact you by electronic and paper ma
il.
You should also get your employer (if you work as a programmer) or yo
ur
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James
Random Hacker.
, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!
A.4 jboss-common-jdbc-wrapper.jar License
You are receiving a copy of jboss-common-jdbc-wrapper.jar in both
source and object code in the following
/src/lib/jboss-common-jdbc-wrapper.jar. The terms of the Oracle
license do NOT apply to jboss-common-jdbc-wrapper.jar; it is
licensed under the following license, separately from the Oracle
programs you receive. If you do not wish to install this library,
you may remove the file /src/lib/jboss-common-jdbc-wrapper.jar,
but the Oracle program might not operate properly or at all
without the library.
This component is licensed under Section A.3, "GNU Lesser General
Public License Version 2.1, February 1999."
A.5 NanoXML License
The following software may be included in this product:
NanoXML
* Copyright (C) 2000-2002 Marc De Scheemaecker, All Rights Reserved.
*
* This software is provided 'as-is', without any express or implied
warranty.
* In no event will the authors be held liable for any damages arisin
g from the
* use of this software.
*
* Permission is granted to anyone to use this software for any purpo
se,
* including commercial applications, and to alter it and redistribut
e it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you mu
st not
* claim that you wrote the original software. If you use this so
ftware in
* a product, an acknowledgment in the product documentation woul
d be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and mu
st not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source dist
ribution.
*
A.6 rox.jar License
The following software may be included in this product:
rox.jar
Copyright (c) 2006, James Greenfield
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions ar
e met:
* Redistributions of source code must retain the above copyright
notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyrig
ht notice,
this list of conditions and the following disclaimer in the doc
umentation
and/or other materials provided with the distribution.
* Neither the name of the nor the names of its con
tributors
may be used to endorse or promote products derived from this so
ftware
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "
AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AR
E
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUE
NTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOO
DS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUS
ED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
A.7 Simple Logging Facade for Java (SLF4J) License
The following software may be included in this product:
Simple Logging Facade for Java (SLF4J)
Copyright (c) 2004-2008 QOS.ch
All rights reserved.
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software
and associated documentation files (the "Software"),
to deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom
the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY
OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
OR OTHER DEALINGS IN THE SOFTWARE.
Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights
reserved. Legal Notices