0

I need to connect Jmeter to my local MS SQL Server database. Everything works fine, when I'm working with remote databases, but when it comes to local databeses I get stuck at the beginning.

I've tried these settings to connect to my DB:

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

And this is what i get:

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.)```
Vladimir Krygin
  • 439
  • 2
  • 6
  • 18
  • 2
    The error message gives you several things to check. Did you do all those things? – Sean Lange Oct 07 '19 at 14:00
  • Have you tried... `jdbc:sqlserver://localhost` – SS_DBA Oct 07 '19 at 14:01
  • jdbc:sqlserver://DESKTOP-IEK3G1S\ <--- is this a typo or is the slash the wrong way? Also, do you have multiple SQL Server installs/instances locally? – Jacob H Oct 07 '19 at 14:07
  • No, this is the only local instance that I have. And I've already tried ```localhost, localhost:1434, localhost:1433```, but the result was ```Cannot create PoolableConnectionFactory (The TCP/IP connection to the host localhost, port 1433 has failed. Error: "connect timed out. Verify the connection properties, check that an instance of SQL Server is running on the host and accepting TCP/IP connections at the port, and that no firewall is blocking TCP connections to the port.".)``` – Vladimir Krygin Oct 07 '19 at 14:10
  • @SeanLange yes, I've already checked everything, everything is ok, but jmeter won't connect – Vladimir Krygin Oct 07 '19 at 14:20
  • Can you show JDBC configuration ? – Ori Marko Oct 07 '19 at 14:49
  • Did you add all JDBC jars to JMeter classpath? – Ori Marko Oct 07 '19 at 15:11

2 Answers2

1

Well, I had to recreate my SQL Browser connection and manually shutdown everything that was turned on in my Firewall options and everything has started working.

Vladimir Krygin
  • 439
  • 2
  • 6
  • 18
0
  1. Enable TCP/IP in the SQL server configuration:

    enter image description here

  2. Enable IP address and set the desired TCP port for the connection:

    enter image description here

  3. SQL Server default TCP port is 1433, most probably you should be using 1433 in your JDBC Connection Configuration setup

  4. Enable SQL Server Authentication mode or add Integrated Security = true to your JDBC URL if you plan to connect with your current credentials (you will need to have sqljdbc_auth.dll file under Java Library Path)
  5. Make sure to use matching SQL Server JDBC Driver
  6. Change "Validation Query" to be select 1
Dmitri T
  • 159,985
  • 5
  • 83
  • 133