如何以编程方式获取JBOSS的数据源

时间:2015-06-22 05:08:44

标签: java jboss

我正在使用JBOSS 7.0应用服务器。我在standalone.xml中声明了我的数据源,如下所示,

<datasource jndi-name="java:jboss/datasources/ltmsfleettrackingds" pool-name="ltmsfleettrackingdspool" enabled="true" jta="true" use-java-context="true" use-ccm="true">
                <connection-url>
                    jdbc:mysql://localhost:3306/fleettrackingdb?zeroDateTimeBehavior=convertToNull&amp;useUnicode=true&amp;characterEncoding=utf-8
                </connection-url>
                <driver>
                    mysqldriver
                </driver>
                <transaction-isolation>
                    TRANSACTION_READ_COMMITTED
                </transaction-isolation>
                <pool>
                    <min-pool-size>
                        10
                    </min-pool-size>
                    <max-pool-size>
                        50
                    </max-pool-size>
                    <prefill>
                        true
                    </prefill>
                    <use-strict-min>
                        false
                    </use-strict-min>
                    <flush-strategy>
                        FailingConnectionOnly
                    </flush-strategy>
                </pool>
                <security>
                    <user-name>
                        root
                    </user-name>
                    <password>

                    </password>
                </security>
                <validation>
                    <validate-on-match>
                        false
                    </validate-on-match>
                    <background-validation>
                        false
                    </background-validation>
                    <useFastFail>
                        false
                    </useFastFail>
                </validation>
                <statement>
                    <prepared-statement-cache-size>
                        100
                    </prepared-statement-cache-size>
                    <share-prepared-statements/>
                </statement>
            </datasource> 

是否可以在java语言中以编程方式获取在standalone.xml中声明的所提到的数据源jndi名称。

0 个答案:

没有答案