Verifying Database Connections
Learn how to verify that your client machine has a TCP/IP sockets Net-Library connection to the database.
August 18, 2003
I have a Visual Basic (VB) application that connects to a SQL Server 2000 database. How can I verify that the client machine has a TCP/IP sockets Net-Library connection to the database?
You can easily determine the Net-Library that a particular connection is using by looking at the sysprocesses table's net_library column in the master database. The master..sysprocesses table contains one row for each connection to the server; a server process ID (SPID) identifies each connection. The following query returns the Net-Library that the connection is using:
SELECT net_library FROM master..sysprocesses WHERE spid = @@spid
Running this T-SQL query from your application lets you determine which Net-Library a connection from your application is using. Of course, you can also manually inspect the sysprocesses table from Query Analyzer to get the information you're looking for. TCP/IP will be the value for the net_library column if you're connected through a TCP/IP sockets connection.
About the Author
You May Also Like