Mar*_*hin 15 jboss datasource sqljdbc jboss7.x
我在独立模式下运行jboss并将数据源设置standalone.xml
为以下内容:
<datasource jndi-name="MyDenaliDS" pool-name="MyDenaliDs_Pool" enabled="true" jta="true"
use-java-context="true" use-ccm="true">
<connection-url>
jdbc:sqlserver://myip:1433;databaseName=mydb;integratedSecurity=true
</connection-url>
<driver>
sqljdbc
</driver>
<security>
<user-name>
username
</user-name>
<password>
password
</password>
</security>
</datasource>
<drivers>
<driver name="sqljdbc" module="com.microsoft.sqlserver.jdbc">
<driver-class>
com.microsoft.sqlserver.jdbc.SQLServerDataSource
</driver-class>
</driver>
</drivers>
Run Code Online (Sandbox Code Playgroud)
在文件夹中%jbosshome%\modules\com\microsoft\sqlserver\jdbc\
我有sqljdb4.jar
以下内容module.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<module name="com.microsoft.sqlserver.jdbc" xmlns="urn:jboss:module:1.0">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
Run Code Online (Sandbox Code Playgroud)
当我启动jboss时它会给我以下错误:
> New missing/unsatisfied dependencies: service
> jboss.jdbc-driver.sqljdbc (missing)
Run Code Online (Sandbox Code Playgroud)
任何人都知道我做错了什么或我错过了什么?
bla*_*ank 13
使用Jboss AS 7.1.1,以及放入模块%jbosshome%\modules\com\microsoft\sqlserver\jdbc\main
我必须对xml做一点改动 - standalone.xml中的驱动元素应该是:
<driver name="sqljdbc" module="com.microsoft.sqlserver.jdbc">
<driver-class>
com.microsoft.sqlserver.jdbc.SQLServerDriver
</driver-class>
</driver>
Run Code Online (Sandbox Code Playgroud)
而module.xml应该是:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.microsoft.sqlserver.jdbc">
<resources>
<resource-root path="sqljdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
<module name="javax.servlet.api" optional="true"/>
</dependencies>
</module>
Run Code Online (Sandbox Code Playgroud)
使用Jboss 7.1.1,我设法让它在没有指定模块的情况下工作.
只需将sqljdbc4.jar放入部署目录:%JBOSSHOME%\ standalone\deployments
standalone.xml中数据源所需的配置如下:
<datasource jndi-name="java:jboss/datasources/myPool" pool-name="myPool" enabled="true" use-java-context="true">
<connection-url>jdbc:sqlserver://127.0.0.1:1433;databaseName=myName;</connection-url>
<driver>sqljdbc4.jar</driver>
<pool>
<min-pool-size>10</min-pool-size>
<max-pool-size>100</max-pool-size>
<prefill>true</prefill>
</pool>
<security>
<user-name>myUser</user-name>
<password>myPassword</password>
</security>
<statement>
<prepared-statement-cache-size>32</prepared-statement-cache-size>
<share-prepared-statements>true</share-prepared-statements>
</statement>
</datasource>
Run Code Online (Sandbox Code Playgroud)
和你之前一样遇到同样的错误
而不是 %jbosshome%\modules\com\microsoft\sqlserver\jdbc\
尝试%jbosshome%\modules\com\microsoft\sqlserver\jdbc\main
并将 jdbc 驱动程序的 .jar 和 module.xml 放在那里。
归档时间: |
|
查看次数: |
32388 次 |
最近记录: |