AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 1158203
Accepted
Vamshi Krishna
Vamshi Krishna
Asked: 2024-04-19 20:49:37 +0800 CST2024-04-19 20:49:37 +0800 CST 2024-04-19 20:49:37 +0800 CST

使用 Microsoft SQL DB 在 JBoss 7.4 中配置数据源

  • 772

我正在使用 MS SQL DB 在 jboss 中创建数据源。所需的驱动程序已加载到模块下。

测试连接失败。机器之间的连接良好。

连接 url - jdbc:microsoft:sqlserver://localhost\dev;databaseName=dev_db

“WFLYJCA0040:无法调用操作:WFLYJCA0047:连接无效”

有人可以帮忙吗?

sql-server
  • 2 2 个回答
  • 48 Views

2 个回答

  • Voted
  1. Arunas Bart
    2024-04-20T05:17:33+08:002024-04-20T05:17:33+08:00

    官方文档指出:

    The general form of the connection URL is
    
    jdbc:sqlserver://[serverName[\instanceName][:portNumber]][;property=value[;property=value]]
    
    where:
    
    jdbc:sqlserver:// (Required) - Is known as the subprotocol and is constant.
    
    serverName (Optional) - Is the address of the server to connect to. This address can be a DNS or IP address, or it can be localhost or 127.0.0.1 for the local computer. If not specified in the connection URL, the server name must be specified in the properties collection.
    
    instanceName (Optional) - Is the instance to connect to on serverName. If not specified, a connection to the default instance is made.
    
    portNumber (Optional) - Is the port to connect to on serverName. The default is 1433. If you're using the default port, you don't have to specify the port, nor the preceding : in the URL.
    
     Note
    
    For optimal connection performance, you should set the portNumber when you connect to a named instance. This will avoid a round trip to the server to determine the port number. If both a portNumber and instanceName are used, the portNumber will take precedence and the instanceName will be ignored.
    
    property (Optional) - Is one or more option connection properties. For more information, see Setting the connection properties. Any property from the list can be specified. Properties can only be delimited by using the semicolon (;), and they can't be duplicated.
    

    您将localhost定义为服务器名,但仍有问题,您说“机器之间的连接看起来很好”,这意味着您要么将错误的服务器名放入连接字符串中,要么弄乱了描述设置的内容。

    最后,建议使用服务器名称和端口号的格式(请使用您配置的端口号):

    jdbc:sqlserver://dbservername:1433;encrypt=true;databaseName=dev_db;integratedSecurity=true;
    

    您已经提到了连接字符串,但某些应用程序需要设置“连接属性”而不是连接字符串。请检查一下。

    最后,请检查 JBoss server.log是否有任何驱动程序特定问题。

    • 2
  2. Best Answer
    Vamshi Krishna
    2024-04-26T16:00:20+08:002024-04-26T16:00:20+08:00

    配置以下连接字符串并解决了问题

    jdbc:sqlserver://serverName;databaseName=dev_db;instanceName=sqldev;selectMethod=cursor;trustServerCertificate=true

    • 0

相关问题

  • sql server 连接字符串上的网络数据包大小以提高吞吐量

  • 基于 Microsoft 的服务器(IIS、MSSQL 等)上的病毒扫描应排除哪些内容?

  • SQL 洗衣清单

  • OPENROWSET、二进制文件、varchars 和 varbinaries

  • 聚集索引与非聚集索引?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve