How to test SQL Server connection properties

698 Views Asked by At

I have a Java application that interacts with a SQL Server database. I want to write some unit tests to test the connection properties like lockTimeout, queryTimeout, loginTimeout and socketTimeout etc.

What would be the best way to test the above scenarios? One approach would be to write code for each situation, prepare the situation and run that piece of code. It will be a kind of manual testing more. Is there any other way/ library to test SQL Server properties?

1

There are 1 best solutions below

5
Geoff Griswald On

You can run queries on the SQL server to determine the config:

--Determine Lock Timeout:
SELECT @@LOCK_TIMEOUT AS LockTimeout

--Determine Remote Query Timeout:
EXEC sp_configure 'remote query timeout'

--Determine Remote Login Timeout:
EXEC sp_configure 'remote login timeout'

The connection / Socket timeout is set in the connection string, so you should already know that.