16.10.2015 Views

Getting Started with IBM Data Studio for DB2

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9– Developing user-defined functions 269<br />

Figure 9.3 – View the User-Defined Functions folder and the routine editor<br />

Note:<br />

For more in<strong>for</strong>mation about using <strong>Data</strong> <strong>Studio</strong> <strong>for</strong> template-based routine development,<br />

refer to the following developerWorks article:<br />

http://www.ibm.com/developerworks/data/library/techarticle/dm-<br />

1010devstudioroutines/index.html<br />

This article uses an earlier version of the Optim Development <strong>Studio</strong> product and stored<br />

procedures as an example, but the in<strong>for</strong>mation is similar <strong>for</strong> <strong>Data</strong> <strong>Studio</strong> and UDFs.<br />

9.3 Deploy the user-defined function<br />

At this point in the UDF development process, the UDF source code exists as a file in your<br />

workspace. Be<strong>for</strong>e you can run your UDF against your database, you must deploy it to the<br />

database server. When deployed, the <strong>DB2</strong> database server compiles the source code, and<br />

creates a new UDF object in the database <strong>with</strong> the compiled code. In case of any compile<br />

errors, the deployment will fail and an appropriate error will be sent back to the client.<br />

To deploy the UDF:<br />

1. Expand the UDF Project in the <strong>Data</strong> Project Explorer view, right-click UDF1 from User-<br />

Defined Functions folder, and select Deploy as shown in Figure 9.4.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!