IBM Database Add-Ins for Visual Studio

Running .NET Applications with Static SQL  (DB2)

After you capture the SQL statements in your .NET application and bind the SQL to databases that the application uses, you are ready to use static SQL to run the application.

If you want to see the SQL in your application that is running statically, you can trace it in log files. You can specify the location and names of the log files.

Prerequisites:

  1. Your .NET application must be open in the Solution Explorer.
  2. You must capture the SQL statements in your .NET application.
  3. You must bind the captured SQL statements in packages, one package for each captured SQL file.
  4. The packages that contain the static SQL must be bound to the databases that the application uses.


To run a .NET application with static SQL:

  1. In the Solution Explorer, right-click the project that contains the .NET application, and then select Optimize IBM SQL Queries.

    The Set Up .NET Application to Optimize SQL Queries window opens.

  2. For each data connection on which you want to run static SQl, perform the following steps:
    1. Set its Capture SQL value to Off.
    2. Set its Run SQL value to Static.
    3. Optional: Specify the full path to the log file for its Trace SQL value.
  3. Click OK.
  4. Run the .NET application.


The SQL statements in the .NET application that are bound in the packages run statically. If a package is not bound and you set its corresponding data connection Run SQL value to Static, the IBM® DB2® and IDS Data Provider does not throw an exception. The application continues to run dynamic SQL.

To troubleshoot problems with SQL statements or generated packages, refer to messages in the IBM Output Message Pane.


See Also

Improving Performance and Security in .NET Applications with Static SQL | Using Static SQL in .NET Applications


.NET Development Forum   DB2 FAQs

© Copyright IBM Corporation 2002, 2019. All Rights Reserved.