Using Connector/J with JBoss
2105
<value>jdbc:mysql://localhost:3306/test</value>
</parameter>
</ResourceParams>
</Context>
Note that Connector/J 5.1.3 introduced a facility whereby, rather than use a
validationQuery
value
of
SELECT 1
, it is possible to use
validationQuery
with a value set to
/* ping */
. This sends a
ping to the server which then returns a fake result set. This is a lighter weight solution. It also has the
advantage that if using
ReplicationConnection
or
LoadBalancedConnection
type connections,
the ping will be sent across all active connections. The following XML snippet illustrates how to select
this option:
<parameter>
<name>validationQuery</name>
<value>/* ping */</value>
</parameter>
Note that
/* ping */
has to be specified exactly.
In general, follow the installation instructions that come with your version of Tomcat, as the way you
configure datasources in Tomcat changes from time to time, and if you use the wrong syntax in your
XML file, you will most likely end up with an exception similar to the following:
Error: java.sql.SQLException: Cannot load JDBC driver class 'null ' SQL
state: null
Note that the auto-loading of drivers having the
META-INF/service/java.sql.Driver
class
in JDBC 4.0 causes an improper undeployment of the Connector/J driver in Tomcat on Windows.
Namely, the Connector/J jar remains locked. This is an initialization problem that is not related to the
driver. The possible workarounds, if viable, are as follows: use "
antiResourceLocking=true
" as a
Tomcat Context attribute, or remove the
META-INF/
directory.
20.3.12. Using Connector/J with JBoss
These instructions cover JBoss-4.x. To make the JDBC driver classes available to the application
server, copy the
.jar
file that comes with Connector/J to the
lib
directory for your server
configuration (which is usually called
default
). Then, in the same configuration directory, in the
subdirectory named deploy, create a datasource configuration file that ends with
-ds.xml
, which tells
JBoss to deploy this file as a JDBC Datasource. The file should have the following contents:
<datasources>
<local-tx-datasource>
<jndi-name>MySQLDB</jndi-name>
<connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
<driver-class>com.mysql.jdbc.Driver</driver-class>
<user-name>user</user-name>
<password>pass</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
<exception-sorter-class-name>
com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter
</exception-sorter-class-name>
<valid-connection-checker-class-name>
com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker
</valid-connection-checker-class-name>
</local-tx-datasource>
</datasources>
Содержание 5.0
Страница 1: ...MySQL 5 0 Reference Manual ...
Страница 18: ...xviii ...
Страница 60: ...40 ...
Страница 396: ...376 ...
Страница 578: ...558 ...
Страница 636: ...616 ...
Страница 844: ...824 ...
Страница 1234: ...1214 ...
Страница 1426: ...MySQL Proxy Scripting 1406 The following diagram shows an overview of the classes exposed by MySQL Proxy ...
Страница 1427: ...MySQL Proxy Scripting 1407 ...
Страница 1734: ...1714 ...
Страница 1752: ...1732 ...
Страница 1783: ...Configuring Connector ODBC 1763 ...
Страница 1793: ...Connector ODBC Examples 1773 ...
Страница 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Страница 1842: ...Connector Net Installation 1822 5 Once the installation has been completed click Finish to exit the installer ...
Страница 1864: ...Connector Net Visual Studio Integration 1844 Figure 20 24 Debug Stepping Figure 20 25 Function Stepping 1 of 2 ...
Страница 2850: ...2830 ...
Страница 2854: ...2834 ...
Страница 2928: ...2908 ...
Страница 3000: ...2980 ...
Страница 3122: ...3102 ...
Страница 3126: ...3106 ...
Страница 3174: ...3154 ...
Страница 3232: ...3212 ...