Jboss wildfly add JDBC driver
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&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的更多相关文章
- Java系列:Add Microsoft SQL JDBC driver to Maven
Maven does not directly support some libraries, like Microsoft's SQL Server JDBC. This tutorial will ...
- Add Microsoft SQL JDBC driver to Maven(转)
from:http://claude.betancourt.us/add-microsoft-sql-jdbc-driver-to-maven/ Add Microsoft SQL JDBC driv ...
- mysql5.6升级为mysql5.7部署jboss/wildfly应用项目
一.部署mysql5.7二进制版 解压tar -xvf mv mysql-5.7 /usr/local/mysql5.7 或者其他文件夹 cd /usr/local/mysql.57 usera ...
- JBoss/Wildfly 配置SQLserver服务器
JBoss/Wildfly 配置SQLserver服务器 http://blog.csdn.net/haitaolang/article/details/60467118 wildfly standa ...
- java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver)
java中myeclipse连接mysql问题(java.lang.ClassNotFoundException: com.mysql.jdbc.Driver) 1.往项目中添加mysql-conne ...
- 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 ...
- 【转】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 ...
- jdbc连接mysql加载驱动程序com.mysql.jdbc.Driver
在开发环境如eclipse,中加载指定数据库的驱动程序.需要下载MySQL支持JDBC的驱动程序mysql-connector-java-5.1.25-bin.jar. 而具体在Java程序中加载驱动 ...
- 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 异常详细信息 ...
随机推荐
- 证明Dijkstra中加入S的点已经最优
语言抽象,仅供自用. 证明一个即将加入S集合的点u必然D[u]=最小值min: 假设D[u] != 最小值,那么即说明存在一条最短路径,该路径可以描述为:S集合中的一个点(至少为起始点) + 一个 ...
- FreeBSD 安裝 Tomcat JAVA JDK1.6 筆記
首先是安裝軟體 cd /usr/ports/java/jdk16/ make 在這一步,需要你手動到sun.com上下載幾個安裝包,按提示下載好後加入到 /usr/ports/distfiles/,再 ...
- hdu 3062 2-SAT问题
思路:裸的2-SAT. #include<map> #include<set> #include<cmath> #include<queue> #inc ...
- 当“逻辑”与“UE”冲突时
如上图. 权限系统有三个对象:用户.角色和组. 角色代表自定义的权限集合. "组"你可以理解为"文件夹"."部门"等名词. 一个用户可以拥有 ...
- SQL 存储过程 执行效率优化提升 (显示估计)
在sql server 查询区 通过执行 "显示估计的执行计划" ,可以给出 存储过程 缺少索引的提示,并自动生成建立相应 索引 的代码 显示估计的执行计划 执行结果提示: 哦,算 ...
- php如何判断当前的操作系统是linux还是windows
php_uname()这个函数的意义在于返回当前PHP所运行的系统的信息,下面对这个函数详细说明一下: /** * 功能:返回当前PHP所运行的系统的信息 * @param string $mode ...
- python:笔记for循环中的else
我们常常会在for循环遍历一个序列或者字典后,接着语句else,很多新手会误以为是判断执行else后面的 代码,其实不然,for循环里面也不存在判断,而已执行完遍历的对象后,再执行else后面的代码. ...
- linux下开发板网络速度测试记录
由于做的项目对于网络和USB的读写速度有很高的要求,因此新拿回来的板子要测试网络和usb的最佳传输速度.要考虑不少因素,先把我能想到的记录下来. 测试的环境是开发板和ubuntu虚拟机 ...
- node笔记——gulp修改静态文件的名字
cmd小技巧: 1.换到下级或同等级目录 D: 2.换到上级目录 cd.. node 包管理器小技巧[以gulp为例] npm install --save-dev gulp gulp-concat ...
- OpenGL第15,16,17讲小结
这三讲没有什么特别的感觉,15讲把纹理贴到3D字体上,16讲讲了雾的生成,17讲是通过以事先保存好的纹理贴图的字体来显示2D文字,这样子不用调用windows的字体,而是使用纹理中的字体.这样也在一定 ...