java - 如何在Jboss 7中使用jndi数据源

标签 java jboss

在 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.

Source discussion

也就是说,我不确定您是否真的在尝试使用“远程”数据源查找。查看数据源配置基础知识指南。

Create DataSource using JBoss 7 JNDI and Spring

Data Source Configuration in AS 7

关于java - 如何在Jboss 7中使用jndi数据源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57866857/

相关文章:

java - 获取大量随机推文

java - 多核 CPU 上的 logback isDebugEnabled() 速度慢吗?

java - 使用数据库中的新数据更新应用程序时出现问题

JBoss 似乎在命令行启动时挂起

jboss - WildFly 服务器发出重复数据源

java - 每个 http 请求都会调用 WildFly 登录模块

java - 如何使用 Apache CSV Parser 读取 Excel(.xlsx) Multipartfile?当前方法不适用于设置为 EXCEL 的 CSVFormat

java - codenameone 的同步连接请求

java - 如何让 Azure App Service Tomcat 将所有 80/443 流量转发到在同一 App Service 上运行的 JBoss

java - 如何通过部署在 JBoss 的 URL 打开没有扩展名的文件