在 Jboss 5 中,我使用了远程数据库的数据源,如下所示:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<datasources>
<local-tx-datasource>
<jndi-name>dsName</jndi-name>
...
<connection-url>jdbc:oracle:thin:@xxx:2074:xx</connection-url>
</local-tx-datasource>
</datasources>
我以这种方式从 applicationContext.xml 调用:
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:dsName"/>
</bean>
可以在Jboss7中实现吗? 在这些帖子中 JBoss 7.1 - declare datasource and access via JNDI https://developer.jboss.org/thread/196876
我发现“AS7 不支持远程查找数据源。”
谢谢
最佳答案
WildFly (and AS7) don't support remote datasource lookup, which I believe is a deliberate decision. If you used it on older versions where it worked, it was incredibly easy to create terrible performance problems, large server-side memory leaks, and more.
What was the use case for having one? The best option is usually to encapsulate the data logic in an EJB which does the DB work server-side, and then call it from the client.
也就是说,我不确定您是否真的在尝试使用“远程”数据源查找。查看数据源配置基础知识指南。
关于java - 如何在Jboss 7中使用jndi数据源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57866857/