此内容没有您所选择的语言版本。

8.2.2. Installing the JDBC Driver and Deploying the Datasource


To add MySQL database connection support to JBoss Enterprise Application Platform:

Procedure 8.1. Red Hat Enterprise Linux 6

  1. Run the following command to install the connector:
    yum install mysql-connector-java
    Copy to Clipboard Toggle word wrap
  2. Run the following command to link the new connector to the JBoss Enterprise Application Platform installation:
    ln -s /usr/lib[64]/gcj/mysql-connector-java/mysql-connector-java<version>.jar.so jboss-as/server/common/lib/mysql-connector-java.jar
    Copy to Clipboard Toggle word wrap

Procedure 8.2. Other Platforms

  1. Download the MySQL Connector/J JDBC Connector from http://www.mysql.com
  2. Deploy the connector:
    1. To make the connector available to all server profiles;

      Extract the mysql-connector-java-<version>.jar file to <JBOSS_HOME>/server/common/lib.
    2. To make the connector available to selected profiles only;

      Extract the file to the lib directory in those server profile directories.
Then create a file in the deploy directory called mysql-ds.xml with the following datasource configuration. Note that the database user name and password corresponds to the MySQL user that we created in the previous section:
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
   <local-tx-datasource>
      <jndi-name>DefaultDS</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/jboss</connection-url>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>jboss</user-name>
      <password>password</password>
      <metadatda>
         <type-mapping>mySQL</type-mapping>
      </metadata>
      <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation> 
   </local-tx-datasource>
</datasources>
Copy to Clipboard Toggle word wrap
To ensure that you have correctly configured the datasource in <JBOSS_HOME>/jboss-as/server/<PROFILE>/deploy folder, start the server and you will notice messages like these in the logs:
INFO  [ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=MySqlDS' to JNDI name 'java:MySqlDS'
Copy to Clipboard Toggle word wrap

Note

Configuring other datasources is a similar process.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat