具有实例名称和域的JDBC连接字符串 [英] JDBC connection string with instance name and domain

查看:97
本文介绍了具有实例名称和域的JDBC连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在SQL Server中创建了一个具有以下配置的数据库:

I have a database created in SQL Server with the following configuration:

此外,我正在尝试连接到名为EDS的数据库.

Also, I am trying to connect to the database named EDS.

为此,我创建了以下详细信息:

For that I created the following details:

我应该在字符串中包含域还是应该在用户名中包含域? 当我转到数据库属性时,我看到所有者拥有. 另外,根据图片,实例部分上的url是否正确?似乎无法转到该特定实例.

Should i have domain in the string or should it be in the username? When i go to the database properties i see the owner has. Also, is the url correct on the instance part according to the image? it looks like it is not able to go to that particular instance.

此外,这是连接的配置(使用Windows Authenticaton)

Also, this is the configuration for the connection (using Windows Authenticaton)

输入用户名时,出现以下错误日志:

When I put in the username I am getting the following error log:

com.microsoft.sqlserver.jdbc.SQLServerException:用户'登录失败. ClientConnectionId:e812971f-b03c-4210-9dbd-de0791bcc304

com.microsoft.sqlserver.jdbc.SQLServerException: Login failed for user '. ClientConnectionId:e812971f-b03c-4210-9dbd-de0791bcc304

推荐答案

在指定SQL Server实例的位置时,通常提供serverName\instanceName serverName:portNumber,但不能同时提供两者.即是

When specifying the location of the SQL Server instance, one normally provides serverName\instanceName or serverName:portNumber, not both. That is, either

jdbc:sqlserver://INNOWAVE-99\SQLEXPRESS01;databaseName=EDS

jdbc:sqlserver://localhost:1433;databaseName=EDS

(假设已将SQLEXPRESS01实例显式配置为侦听端口1433,而对于SQL Express实例通常不是这种情况.)

(assuming that the SQLEXPRESS01 instance has been explicitly configured to listen on port 1433, which is not usually the case for a SQL Express instance).

建立连接网址

如果同时使用portNumber和instanceName,则portNumber将优先,而instanceName将被忽略.

If both a portNumber and instanceName are used, the portNumber will take precedence and the instanceName will be ignored.

没有为Microsoft的SQL Server JDBC驱动程序的连接URL定义domain=属性.使用integratedSecurity=true连接属性(并且 not 显式提供用户名和密码)隐式完成使用Windows域凭据登录SQL Server实例.详细信息此处.

There is no domain= property defined for the connection URL for Microsoft's JDBC driver for SQL Server. Logging in to the SQL Server instance with Windows domain credentials is done implicitly using the integratedSecurity=true connection property (and not explicitly providing a username and password); details here.

这篇关于具有实例名称和域的JDBC连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆