Jboss wildfly  添加 JDBC driver

我这里使用的是 wildfly-8.0.0.Final

第一步:

首先在modules里面添加mysql的驱动包

例如:modules\system\layers\base\com  在这下面新建 mysql文件夹,然后在mysql下面建子文件夹 main,这个main名字不能随便修改,这是规则。

整体路劲如下:

modules\system\layers\base\com\mysql\main

然后在main下面新建一个module.xml文件内容如下:

<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source.
~ Copyright 2011, 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 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 software 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 software; if not, write to the Free
~ Software Foundation, Inc., 51 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 -->
<module xmlns="urn:jboss:module:1.1" name="com.mysql">
<resources>
<resource-root path="mysql-connector-java-5.1.7-bin.jar"/>
<!-- Insert resources here -->
</resources> <dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>

name="com.mysql" 这个后面会用到,名字随便起,后面用的时候对应这个名字就行了

path="mysql-connector-java-5.1.7-bin.jar" 是mysql的驱动包
把mysql的驱动包拷到当前main目录下,注意path的名字要一样 第二步:
添加JNDI
我这里启动的是 standalone
打开standalone\configuration\standalone.xml 找到 drivers 节点 在里面添加一个driver 节点
如下:
<driver name="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>

这里的module 就是第一步建的module.xml里面的name

然后找到datasources节点,在里面添加一个datasource 如下:

<datasource jndi-name="java:/MySQLDS" pool-name="MySQLDS" >
<connection-url>jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=utf-8</connection-url>
<driver>MySQLDSDriver</driver><!--对应上面的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>
</validation>
<statement>
<share-prepared-statements>false</share-prepared-statements>
</statement>
-->
</datasource>

Jboss wildfly add JDBC driver的更多相关文章

  1. Java系列:Add Microsoft SQL JDBC driver to Maven

    Maven does not directly support some libraries, like Microsoft's SQL Server JDBC. This tutorial will ...

  2. Add Microsoft SQL JDBC driver to Maven(转)

    from:http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/ Add Microsoft SQL JDBC driv ...

  3. mysql5.6升级为mysql5.7部署jboss/wildfly应用项目

    一.部署mysql5.7二进制版 解压tar -xvf mv mysql-5.7  /usr/local/mysql5.7  或者其他文件夹 cd  /usr/local/mysql.57 usera ...

  4. JBoss/Wildfly 配置SQLserver服务器

    JBoss/Wildfly 配置SQLserver服务器 http://blog.csdn.net/haitaolang/article/details/60467118 wildfly standa ...

  5. java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)

    java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver) 1.往项目中添加mysql-conne ...

  6. myeclipe eclipse 常遇问题:Some projects cannot be imported 、java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver、The file connot be validate

    1.Some projects cannot be imported because they already exist in the workspace 2.Some projects were ...

  7. 【转】Install Oracle Jdbc driver in your Maven local repository

    Install Oracle Jdbc driver in your Maven local repository If you are using Oracle, you must first in ...

  8. jdbc连接mysql加载驱动程序com.mysql.jdbc.Driver

    在开发环境如eclipse,中加载指定数据库的驱动程序.需要下载MySQL支持JDBC的驱动程序mysql-connector-java-5.1.25-bin.jar. 而具体在Java程序中加载驱动 ...

  9. Exception 02 : java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver

    异常名称 java.lang.ClassNotFoundException: Could not load requested class : com.mysql.jdbc.Driver 异常详细信息 ...

随机推荐

  1. Strom实现数字累加Demo

    import java.util.Map; import backtype.storm.Config; import backtype.storm.LocalCluster; import backt ...

  2. poj 1695 动态规划

    思路:和黑书上的跳舞机类似 #include<map> #include<set> #include<cmath> #include<queue> #i ...

  3. HTML CSS编码规范(黄金定律)

    HTML 语法 用两个空格来代替制表符(tab) -- 这是唯一能保证在所有环境下获得一致展现的方法. 嵌套元素应当缩进一次(即两个空格). 对于属性的定义,确保全部使用双引号,绝不要使用单引号. 不 ...

  4. WEB系统架构

    客户端方向:框架+控件+模板+元数据辅助:懒加载+合并请求+异步任务+推送+缓存技术:reactjs,requirejs,jquery,angularjs,bootstrap,ant.design,f ...

  5. Log4net记录日志存库并存本地

    <?xml version="1.0" encoding="utf-8"?> <configuration> <configSec ...

  6. MSSQL数据库逻辑文件名修改与查看

    逻辑文件名是什么 你用的程序连接的时候使用的是数据库名,然后你在你的数据库右击属性的时候,左上角单击"文件",可以看到,数据库名和逻辑文件名是不一样的,你可以看自己的数据库的路径下 ...

  7. js数组与字符串的相互转换方法

    一.数组转字符串 需要将数组元素用某个字符连接成字符串,示例代码如下: var a, b; a = new Array(0,1,2,3,4); b = a.join("-"); 二 ...

  8. 6步图文教你优化myeclipse2014

    MyEclipse 2014优化速度方案仍然主要有这么几个方面:去除无需加载的模块.取消冗余的配置.去除不必要的检查.关闭更新. 第一步: 去除不需要加载的模块 一个系统20%的功能往往能够满足80% ...

  9. Cocos2d-JS中的文本菜单

    文本菜单是菜单项只能显示文本,文本菜单类包括了cc.MenuItemLabel.cc.MenuItemFont和cc.MenuItemAtlasFont.cc.MenuItemLabel是个抽象类,具 ...

  10. 生动详细解释javascript的冒泡和捕获,包懂包会(转)

    前言:虽然精通jquery,但对它的原型javascript却不是很了解,最近在学习javascript中遇到了一些困难,比如冒泡和捕获,很多次被提到,但又不知究竟应用在何处.找到了一些好文章解惑,在 ...