Jmeter无法连接到本地MS SQL服务器

时间:2019-10-07 13:58:02

标签: sql sql-server jmeter

我需要将Jmeter连接到本地MS SQL Server数据库。当我使用远程数据库时,一切正常,但是当涉及到本地数据集时,我一开始会陷入困境。

我尝试了以下设置以连接到数据库:

Database URL: jdbc:sqlserver://DESKTOP-IEK3G1S\SQLEXPRESS;DatabaseName=TestBase
JDBC Driver class :  com.mircrosoft.sqlserver.jdbc.SQLServerDriver

这就是我得到的:

Response message: java.sql.SQLException: 
Cannot create PoolableConnectionFactory (The connection to the host DESKTOP-IEK3G1S, named instance sqlexpress has failed. 
Error: "java.net.SocketTimeoutException: 
Receive timed out". Verify the server and instance names, check that no firewall is blocking UDP traffic to port 1434, and for SQL Server 2005 or later verify that the SQL Server Browser Service is running on the host.)```

2 个答案:

答案 0 :(得分:1)

好吧,我不得不重新创建SQL Browser连接,并手动关闭防火墙选项中打开的所有内容,并且一切都开始工作。

答案 1 :(得分:0)

  1. Enable TCP/IP在SQL Server配置中:

    enter image description here

  2. 启用IP地址并设置用于连接的所需TCP端口:

    enter image description here

  3. SQL Server default TCP port is 1433,很可能应该在JDBC Connection Configuration设置中使用1433

  4. 启用SQL Server Authentication模式或将Integrated Security = true添加到JDBC URL(如果您打算使用当前凭据进行连接(您将需要在Java Library Path下使用sqljdbc_auth.dll文件)< / li>
  5. 确保使用匹配的SQL Server JDBC Driver
  6. "Validation Query"更改为select 1