Вы находитесь на странице: 1из 2

How To: Executing SQL statements against the WhatsUp Gold database

http://whatsup.custhelp.com/cgi-bin/whatsup.cfg/php/enduser/prnt_adp.p...

How To: Executing SQL statements against the WhatsUp Gold database
How do I run a SQL statement or query against the database used by the WhatsUp Gold software?

There are several options available, depending upon your particular SQL configuration. If the product is using a database instance your organization owns or you have installed yourself, contact your database administrator and have them run the SQL statement for you. If you are using the free SQL Express Edition database which was installed by the WhatsUp Gold software, you can use the sqlcmd utility which is installed as part of the SQL Client Tools package. More information on sqlcmd can be found on Microsoft's web site via the links at the bottom of this article. In order to successfully connect to a SQL instance, there are several pieces of information you need to obtain about your environment to use with the sqlcmd utility. You will need the location of the SQL instance, the authentication method used along with the appropriate credentials, and the database against which the statement should be executed. Determine the location of your SQL instance: 1. On the WhatsUp Gold computer, in the Windows Administrative Tools Control Panel, open the Data Sources (ODBC) applet. If WhatsUp Gold is installed on a 64-bit operating system, open the 32-bit version of this applet. By default, its location is C:\Windows\SysWOW64\odbcad32.exe on a 64-bit operating system. 2. Click the System DSN tab. 3. Select the WhatsUp item from the list of System Data Sources and click the Configure button. 4. Note the value in the Server field. This is the location of the SQL instance used by the WhatsUp Gold software. 5. You can click the Next button to determine the authentication method and which credentials to use in authentication. Determine the authentication method for your SQL instance: 1. On the WhatsUp Gold computer, in the Windows Administrative Tools Control Panel, open the Data Sources (ODBC) applet. If WhatsUp Gold is installed on a 64-bit operating system, open the 32-bit version of this applet. By default, its location is C:\Windows\SysWOW64\odbcad32.exe on a 64-bit operating system. 2. Click the System DSN tab. 3. Select the WhatsUp item from the list of System Data Sources and click the Configure button. 4. Click the Next button. If the With Windows NT authentication using the network login ID. radio button is selected, WhatsUp Gold has been configured to use Windows authentication. If the With SQL Server authentication using a login ID and password entered by the user. radio button is selected, WhatsUp Gold has been configured to use SQL authentication. The SQL username for the connection will be listed in the Login ID field. For security reasons, the password is not saved by this dialog. 5. Click the Cancel button to close the DSN Configuration Wizard and then click the Cancel button to close the Data Sources applet. Now that we have the location of the SQL instance and the authentication information we need to connect to it, we have enough information to be able to execute a SQL statement. Executing the SQL statement using sqlcmd: 1. On the WhatsUp Gold computer, open a command-prompt. If running on Windows Vista or later operating system, be sure to open the command prompt with administrative privileges. 2. Navigate to the SQL Client Tools program directory. By default, this is C:\Program Files\Microsoft SQL Server\90 \Tools\Binn\. If WhatsUp Gold is installed on a 64-bit operating system, this path is C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\. 3. Execute the SQL query using the sqlcmd utility. If using Windows authentication, execute the following case-sensitive command, all on a single line. sqlcmd.exe -S "servername" -E -d "databasename" -Q "SQL query" If using SQL authentication, execute the following case-sensitive command, all on a single line. sqlcmd.exe -S "servername" -U "sql username" -P "SQL password"-d "databasename" -Q "SQL query" Examples: In the below examples, the SQL statement being executed is SELECT [sValue] FROM [dbo].[DatabaseProperty] WHERE [sName] = 'Version'. This query returns the database version for the WhatsUp Gold product and can be used to verify

1 of 2

6/3/2011 12:40 PM

How To: Executing SQL statements against the WhatsUp Gold database

http://whatsup.custhelp.com/cgi-bin/whatsup.cfg/php/enduser/prnt_adp.p...

connectivity to the SQL database. Your SQL instance is NMS\WHATSUP, you use Windows authentication to connect to the database and you wish to execute a statement against the WhatsUp database. sqlcmd.exe -S "NMS\WHATSUP" -E -d "WhatsUp" -Q "SELECT [sValue] FROM [dbo].[DatabaseProperty] WHERE [sName] = 'Version'" Your SQL instance is SQLSERVER1, you use SQL authentication to connect to the database with a SQL user named wugsql and password of P@ssw0rd. You wish to execute a statement against the WhatsUp database. sqlcmd.exe -S "SQLSERVER1" -U "wugsql" -P "P@ssw0rd" -d "WhatsUp" -Q "SELECT [sValue] FROM [dbo]. [DatabaseProperty] WHERE [sName] = 'Version'" Your SQL instance is NETMGMT\WHATSUP, you use SQL authentication to connect to the database with a SQL user of sa and password of WhatsUp_Gold. You wish to execute a statement against the WhatsUp database. sqlcmd.exe -S "NETMGMT\WHATSUP" -U "sa" -P "WhatsUp_Gold" -d "WhatsUp" -Q "SELECT [sValue] FROM [dbo]. [DatabaseProperty] WHERE [sName] = 'Version'" External Reference Links: Microsoft Developer Network: Using the sqlcmd Utility Microsoft Developer Network: sqlcmd Utility (Reference)

Answer ID Products

1164

WhatsUp Gold v11.x v12.0.0 v12.3.0 v12.4.0 v14.x


09/08/2010 11:47 AM

Last Updated

2 of 2

6/3/2011 12:40 PM

Вам также может понравиться