Latest News

the latest news from our team

Calling database stored procedures

You can call stored procedures using an eFORMz database connection. First, you configure the database connection, then create a variable to pass to the stored procedure, and then create a variable to store the result that the stored procedure returns. The advantage of using a stored procedure over SQL is that the stored procedure is precompiled, and the execution plan is already determined.

Complete the following steps to call a stored procedure your database server:

Define your database connection

  1. Start the eFORMz Composer and open your project.
  2. Click Projects > Properties and go to the Databases tab.
  3. Click New and define your database connection:
    Database connection name The local name to identify the database connection.
    Driver class The identity of the file that tells Java how to connect. More information is at Supported URL and Driver Classes.
    URL The connection string for the database. The URL includes the IP address or host name and port to connect to along with properties such as a user ID, password, and default schema.
    Properties You can add properties to include in the URL here.
    The Configure database connection window

    The Configure database connection window

  4. Click Test to test the connection.
  5. Optional: Click Save to file to save the connection definition in a separate file so you can reuse the connection with other projects.
  6. Click OK to close the Configure database connection window.
  7. In the Project Properties window, select the database connection name, and then click Activate.
  8. Click OK.

Create the variable to pass to the stored procedure

You can create this variable several ways. For details, see “Creating an eFORMz Variable” in the Minisoft eFORMz Manual. You can skip this step if your stored procedure does not require a parameter.

Create a second variable to store the value that the stored procedure returns

  1. Add a variable to your form by right clicking Variables > Add Variable > By position…
  2. Type a name for the variable and click OK.

Create a SQLLoad procedure to call the stored procedure

  1. Right click the form > Add Pre-condition Procedure > SQL Load.
  2. Type a name for the procedure and select the variable to store the results to. Click OK.
  3. In the SQL Load window, select your database connection.
  4. Click Constant and in the text field, type the text that calls the stored procedure, using a question mark (?) to indicate a parameter to pass, if you pass one. This example calls the stored procedure, sp_MyStoredProc:
    exec sp_MyStoredProc ?
  5. In the Parameters area, click Add and select the variable to pass to the stored procedure.
  6. In the

Leave a Reply

Your email address will not be published. Required fields are marked *

*

code