Jboss wildfly Add JDBC Driver

Source: Internet
Author: User
Tags jboss wildfly

Jboss wildfly Add JDBC Driver

I'm using wildfly-8.0.0.final here.

The first step:

First, add the MySQL driver package to the modules

For example: modules\system\layers\base\com create a new MySQL folder under this, and then create a subfolder under MySQL Main, this main name can not be arbitrarily modified, this is the rule.

The overall road strength is as follows:

Modules\system\layers\base\com\mysql\main

Then create a new Module.xml file below main below the following:

<?XML version= "1.0" encoding= "UTF-8"?><!--  ~ JBoss, Home of Professional Open Source. ~ Copyright, Red Hat, Inc., and individual contributors ~ As indicated by the @author tags.  See the Copyright.txt file in the ~ distribution for a full listing of individual contributors. ~ ~ This is the free software; You can redistribute it and/or modify it-under the terms of the GNU Lesser general public License as ~ published by TH e free software Foundation;  Either version 2.1 of ~ the License, or (at your option) any later version. ~ ~ This software was distributed in the hope so it would 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 has received a copy of the GNU Lesser general public ~ License along with this software; If not, write to the free ~ Software Foundation, Inc., Wuyi Franklin St, Fifth Floor, Boston, MA ~ 02110-1301 USA, or see The FSF Site:httP://www.fsf.org.    -<!--represents the Hibernate 4.1.x (works with Hibernate 4.2.x jars also) module -<Modulexmlns= "urn:jboss:module:1.1"name= "Com.mysql">    <Resources>        <Resource-rootPath= "Mysql-connector-java-5.1.7-bin.jar"/>        <!--Insert Resources here -    </Resources>    <Dependencies>        <Modulename= "Javax.api"/>        <Modulename= "Javax.transaction.api"/>    </Dependencies></Module>

Name= "Com.mysql" This back will be used, the name casually, the back of the time corresponding to the name on the line

Path= "Mysql-connector-java-5.1.7-bin.jar" is the MySQL driver package
Copy the MySQL driver package to the current main directory, and note that the name of path is the same

Step Two:
Add Jndi

Open Standalone\configuration\standalone.xml Find Drivers node add a driver node inside
As follows:
<Drivername= "Mysqldsdriver"Module= "Com.mysql">                        <Driver-class>Com.mysql.jdbc.Driver</Driver-class>                        <Xa-datasource-class>Com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</Xa-datasource-class>                    </Driver>

The module here is the first step to build the name of the module.xml inside.

Then find the DataSources node and add a datasource as follows:

<DataSourceJndi-name= "Java:/mysqlds"Pool-name= "Mysqlds" >                    <Connection-url>Jdbc:mysql://localhost:3306/test?useunicode=true&amp;Characterencoding=utf-8</Connection-url>                    <Driver>Mysqldsdriver</Driver><!--corresponds to device name---                    <Security>                        <User-name>Username</User-name>                        <Password>Password</Password>                    </Security>                    <Pool>                        <min-pool-size>30</min-pool-size>                        <max-pool-size>100</max-pool-size>                        <Prefill>True</Prefill>                    </Pool>                    <!--<validation> <validate-on-match>false</validate-on-match> <background-validation>false</background-validation> </validatio N> <statement> <share-prepared-statements>false</share-prepare D-statements> </statement> -                </DataSource>




Jboss wildfly Add JDBC Driver

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.