Troubleshooting Connector/J Applications
2120
// 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.
21.3.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
, 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
or
DELETE
statements on a table where you can individually specify the criteria to be
matched using a
WHERE
clause.
21.3.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
[421]
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
Section C.5.2.2, “
Can't connect to [local] MySQL server
”
.
21.3.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 failed
at java.net.SocketInputStream.socketRead0(Native Method)
at java.net.SocketInputStream.read(Unknown Source)
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 ...