jboss 7.0.2上的连接池不能正常工作

时间:2016-05-27 15:30:13

标签: java jboss connection-pooling

我试图在JBoss上建立一个池连接,我在互联网上看到很多关于这个的事情,但没有任何作用......

<?xml version="1.0" encoding="UTF-8"?>

<subsystem xmlns="urn:jboss:domain:datasources:1.0">
    <datasources>
        <datasource jndi-name="java:jboss/datasources/db_test" pool-name="db_testDS">
            <connection-url>jdbc:sqlserver://----------;databaseName=db_test</connection-url>
            <driver>MSSQL</driver>
            <pool>
                <min-pool-size>5</min-pool-size>
                <max-pool-size>30</max-pool-size>
                <prefill>true</prefill>
            </pool>
            <security>
                <user-name>us***</user-name>
                <password>mo***</password>
            </security>
        </datasource>

        <drivers>
            <driver name="MSSQL" module="com.microsoft.sqlserver.jdbc.SQLServerDriver">
                <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerDriver</xa-datasource-class>
            </driver>
        </drivers>
  </datasources>

</subsystem>

当我进入JBoss管理员时,db_test不是apear

什么是狼?

1 个答案:

答案 0 :(得分:0)

    Please refer the link. 
    https://access.redhat.com/documentation/en-US/JBoss_Enterprise_Application_Platform/6/html/Administration_and_Configuration_Guide/Example_Microsoft_SQLServer_Datasource1.html

    Select appropriate database drivers and you will get the correct configuration.

    Following is the configuration for MS SQL Server    

        The example below is a Microsoft SQLServer datasource configuration. The datasource has been enabled, a user has been added, and validation options have been set.
        <datasources>
          <datasource jndi-name="java:/MSSQLDS" pool-name="MSSQLDS">
            <connection-url>jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MyDatabase</connection-url>
            <driver>sqlserver</driver>
            <security>
              <user-name>admin</user-name>
              <password>admin</password>
            </security>
            <validation>
              <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mssql.MSSQLValidConnectionChecker"></valid-connection-checker>
            </validation>
          </datasource>
          <drivers>
            <driver name="sqlserver" module="com.microsoft">
              <xa-datasource-class>com.microsoft.sqlserver.jdbc.SQLServerXADataSource</xa-datasource-class>
            </driver>
        </datasources>
================================================================================
        The example below is a module.xml file for the Microsoft SQLServer datasource above.
================================================================================
        <module xmlns="urn:jboss:module:1.1" name="com.microsoft">
          <resources>
            <resource-root path="sqljdbc4.jar"/>
          </resources>
          <dependencies>
            <module name="javax.api"/>
            <module name="javax.transaction.api"/>
          </dependencies>
        </module>