Skip to main content

The Link Procedure Wizard: Linking to a Stored Procedure

The Link Procedure Wizard: Linking to a Stored Procedure

The Management Portal provides a wizard that you can use to link to a stored procedure defined in an external ODBC- or JDBC-compliant database. When you link to the procedure, the system generates a method and a class to contain the method. When you link to an stored procedure, you create a class method that does the same action that the stored procedure does. This method is marked with the SqlProc keyword. The class method is generated within a new class, and you can specify information such as the class and package name. This method cannot accept a variable number of arguments. Default parameters are permitted, but the signature of the stored procedure is fixed.

Note:
Closing the Link Procedure Connection

By design, the code generated by the Link Procedure Wizard does not close the connections that it opens. This avoids problems such as conflicts between SQL statements that share the same connection. See “Controlling SQL Gateway Connections” for more information.

  • If you have not yet created a connection to the external database, do so before you begin (see “Creating SQL Gateway Connections for External Sources”).

  • From the Management Portal select System Explorer, then SQL. Select a namespace by clicking the name of the current namespace displayed at the top of the page; this displays the list of available namespaces.

    At the top of the page, click the Wizards drop-down list, and select Link Procedure.

  • On the first page of the wizard, select one or more procedures, as follows:

    • Select a destination namespace — Select the InterSystems IRIS namespace to which the data will be copied.

    • Schema Filter — Specify a schema (class package) name that contains the procedure. You can specify a name with wildcards to return multiple schemas, or % to return all schemas. For example, C% will return all schemas in the namespace beginning with the letter C. Use of this filter is recommended, as it will shorten the return list of schemas to select from, and thus improve loading speed.

    • Procedure Filter — Specify a procedure to link to. You can specify a name with wildcards to return multiple procedures, or % to return all procedures. You can select multiple procedures. In this case, when you click Next, the next screen prompts you for a package name. Specify the name of the package to contain the classes and then click Finish.

    • Select a SQL Gateway connection — Select the SQL Gateway connection to use.

  • Click Next.

  • On the second page, specify details about the class to generate in InterSystems IRIS:

    • New package name — Specify the name of the package to contain the class or classes.

    • New class name — Specify the name of the class to generate.

    • New procedure name — Specify the name of the procedure; specifically this controls the SqlName keyword of the method.

    • New method name — Specify the name of the method to generate.

    • Description method name — Optionally provide a description of the method; this is used as a comment for the class definition, to be displayed in the class reference.

  • Click Finish. The wizard displays the Background Jobs page with a link to the background tasks page.

  • Click Close. Or click the given link to view the background tasks page. In either case, the wizard starts a background task to do the work.

The wizard stores a new class definition within the InterSystems IRIS database and compiles it.

Note:

This wizard generates ObjectScript code with class names and class member names that you control. When you use this wizard, be sure to follow the rules for ObjectScript identifiers, including length limits (see the section on Naming Conventions in Defining and Using Classes).

FeedbackOpens in a new tab