Creating static DB2 queries
If you are using DB2, you can run query specifications either dynamically or statically. If you use dynamic queries, each SQL statement is prepared at runtime. With static queries, the SQL statements are precompiled before runtime so the prepare is not necessary. If you have many different queries, using static SQL support helps your application run much faster. If you only have a few queries that are executed repeatedly, you may not notice much of a difference.
To create static queries, do the following:
1. On the Query Specifications page of the Multi-row Query settings, select the
Package Specs... button. This opens the Database package specifications window.
2. From the Access Set drop-down list, select an access set.
For the sample application, select SampleDatabaseAccessSet.
3. From the Connection Alias drop-down list, select the Connection specification for your application.
For the sample application select SampleConSpec.
4. In the Package Name field, type a package name.
For the sample application, type SampleDatabaseStaticPackage.
5. Select
Save. A package spec must be saved before you can precompile it. The last saved version of the package is precompiled. See
Precompiling static SQL for information on precompiling your package spec.
6. On the Multi-row Query settings window, select the Package Name for the package you created, then select OK. The queries for the Multi-row Query part are added to the package.
Note:
When you apply the settings for an updatable part, VA Smalltalk automatically generates queries that are required for runtime, stores them in the access set, and adds them to the package. If you add queries to a package specification manually, the automatically generated queries will not be included in the package. If you are using VA Smalltalk parts, you should let the Multi-row Query settings manage the package for you.
It is a good idea to finish your application and test it before precompiling packages. After you finish the sample application and test it, precompile the package spec and try testing again.
Last modified date: 06/01/2018