Peter Williams
Microsoft Corporation
Created: October 6, 1994
Click to open or copy the files in the SQLEYE sample application for this technical article.
This article describes SQLEYE, which is a Windows NT™–based open data services (ODS) application that can be used to view or log the information being sent between SQL Server and its clients.
SQLEYE is a "pass-through" gateway application that can be used to view or log the information being sent between SQL Server and its clients. A client application that normally connects directly to SQL Server can instead connect to SQLEYE. SQLEYE will, in turn, connect to SQL Server, providing a link that is transparent to the application.
Once the communication link has been established, SQLEYE allows you to view and or log the following:
It is also possible to attach timing information to each of the above.
Information displayed by SQLEYE (the main window title reflects the startup parameters)
The Transact-SQL™ queries can be recorded in script files on a per-connection basis. These files can be used to replay the activity of the client application.
Files that hold Statistics IO and Statistics TIME information can also be created. These script files can be used to populate statistics tables against which ad-hoc queries can then be run.
Most SQL Server applications work transparently through SQLEYE without any modification, including open database connectivity (ODBC) applications such as Microsoft® Access® version 2.0, when you use the SQL Server ODBC driver.
If you choose to display information on the screen, a new child window is created for each new user connection. These windows display the information using various color codes to distinguish the different information types. When these windows are minimized, the icon can be related to the specific application. The icon is mapped to the application name using the SQLEYE.MAP file, which should be in the same directory as SQLEYE.EXE.
The format of SQLEYE.MAP is:
<SQL application name> <tab> <The icon file (normally the application's .EXE)> <cr,lf>
The supplied SQLEYE.MAP file contains mappings for the standard SQL Server applications. This file can be edited as needed.
When minimized, various overlay icons are used to display the state of the respective connection:
If no application-specific icon has been specified in SQLEYE.MAP, a default face icon is used and the hourglass overlay is replaced with the eyes opening on the default icon.
Excluding the log file, SQLEYE can produce three types of files listed in the File menu:
The displayed data is controlled by the View menu:
The View menu is grayed if the gateway is started without the Screen Display check box selected.
You can log all information in a file called SQLEYE.LOG. This file can be configured dynamically any time through the options in the Log menu, which are similar to the options in the View menu.
The gateway can be controlled using the Gateway menu.
Shutting down the gateway prevent new users from connecting via SQLEYE (including the System Administrator). Once all existing connections though SQLEYE have been closed, SQLEYE will display a message and terminate itself. This can only be done remotely and is analogous to the SQL Server Shutdown command. The System Administrator must send the shutdown sqleye command from a query window. SQLEYE will recognize this command and will not pass it to the SQL Server.
Although it is possible to terminate SQLEYE from the console, this is analogous to shutdown with "no wait" (it will not wait for users to disconnect before termination). Although warnings are displayed, it is up to the user to ensure that it is safe to shut down SQLEYE in this way.
You can use the Send to all users option to send a DB-Library message to all users connected via SQLEYE. Some applications may not display these messages.
This menu controls the windows and their properties.
The recommended configuration (and the default starting option) is for new windows to be created in the minimized state using little processor time and giving a general overview of server activity. Any windows that are of particular interest can be restored. They will automatically be tiled and will begin to scroll as new information arrives.
Although a default server name is specified when SQLEYE is started, it is possible to override this setting and log into several different servers simultaneously via one instance of SQLEYE. To do this, the client application should append @servername to the login ID. For example, user Fred who wishes to connect via SQLEYE to a SQL Server called OtherServer should specify a user name of Fred@OtherServer. SQLEYE will then login to OtherServer using the user name Fred.
To run SQLEYE in the default minimum configuration, you will need the files listed below.
Application-specific files:
SQLEYE.EXE | Main program |
SQLEYE.MAP | Icon mapping file described earlier |
General SQL Server DLLs (supplied with SQL Server) and normally installed in the \SQL\DLL directory:
DBNMPNTW.DLL | Named pipe Net-Library (client side) |
SSNMPNTW.DLL | Named pipe Net-Library (server side) |
NTWDBLIB.DLL | Windows NT™ DB-Library |
OPENDSNT.DLL | ODS library run time |
Important Note OPENDSNT.DLL ships with all version of SQL Server and can also be licensed separately.
Please read your Microsoft SQL Server and Microsoft Open Data Services license agreements for further details. The following installation instructions assume that you have valid licenses for the necessary DLLs.
If you are using a protocol other than named pipes, the relevant Net-Libraries are required.
If you are installing SQLEYE on a server that is not running SQL Server, no further setup is necessary. SQLEYE will start on the default pipe (\\.\pipe\sql\query). This will appear to the client application as if it were SQL Server.
If you are installing SQLEYE on the same machine as SQL Server, either SQL Server or SQLEYE will need to be started on an alternate pipe.
To start SQLEYE on an alternate pipe:
At this point, you can start SQLEYE by leaving the server field blank (this will default to the local server) and specifying sqleye as the registry key.
Note Only those clients that have been configured in this way can connect via SQLEYE. All other clients will connect directly to the SQL Server.
Other Net-Libraries may be used; please see the SQL Server Configuration Guide for further information.
Note No client configuration is now necessary; all clients will connect via SQLEYE. However, if SQLEYE is not running, no clients will be able to connect to SQL Server (unless you inform them of the new pipe name).
Other Net-Libraries may be used; please see the SQL Server Configuration Guide for further information.
To run several instances of SQLEYE on the same machine, you will need to create a registry key for each instance, because each instance must have a unique pipe name.
When you start SQLEYE, an initialization dialog that requires the following information is displayed:
You can specify various command-line parameters to allow SQLEYE to be started from a batch file:
/r <registry key> | This should contain a ListenOn value | |
/s <server name> | The default server to connect to | |
/m <start minimized> | SQLEYE will start minimized | |
/a | Auto-start (no configuration screen) | |
/l | Log only (the Screen Display check box is not selected) |