- GRANT LOGON ON ALL TO username WITH NULL PASSWORD;
- GRANT CREATE EXTERNAL PROCEDURE, DROP PROCEDURE ON database TO username;
- GRANT ALL ON SYSUDTLIB TO username;
- When creating Java external stored procedures, an additional grant is needed:
GRANT ALL ON SQLJ TO username;
Using External Stored Procedures
To create and use external stored procedures, you must use the External Routine Installation Tool and External Routine Migration Tool. Users must authenticate themselves using a Personal Access Token and the private key used to generate the token before they can create or use external stored procedures. Follow the instructions for Creating a Personal Access Token, and store the PAT with the private key for use during the migration of SQL scripts and installation of external stored procedures.
Creating an External Stored Procedure
- Organization whose org_key is examplecorp
- Organization tenant account_name is ExampleCorp-Tenant-001
- Database user is bobby
- Directory ./xsp_src which contains the XSP manifest.json file and all the source files defining the external stored procedure
tdextroutine -k examplecorp -n ExampleCorp-Tenant-001 -u bobby xsp create -s ./xsp_src -d MarketingDB XSP_DEMO
- Parses the manifest.json file and generates a .zip artifact file.
- Uploads the artifact file to the tenant artifact bucket.
- Initializes an XSP Creation Job.
- Monitors the job until it finishes.
- Displays a success or error message on job completion.
Listing an External Stored Procedure
tdextroutine xsp list
======== =========== ========== ========== ================ XSP ID Database XSP Source Routine Name Language Kind ========= =========== ========== ========== ================ AADNGAAA MarketingDB XSP_DEMO JAVA REGULAR_FUNCTION ======== =========== ========== ========== ================
tdextroutine xsp list -d MarketingDB
======== =========== =========== ========== ================ XSP ID Database XSP Source Routine Name Language Kind ======== =========== =========== ========== ================ AADNGAAA MarketingDB XSP_DEMO JAVA REGULAR_FUNCTION ======== =========== =========== ========== ================
For details about the options of the tdextroutine xsp list command, see tdextroutine External Stored Procedure Subcommands and Options.
Fetching Details of an Existing External Stored Procedure
tdextroutine xsp fetch XSP_ID
XSP_ID identifies the external stored procedure. The identifier is returned by the tdextroutine xsp create command or tdextroutine xsp list command. For example, the XSP_ID returned in the previous tdextroutine xsp list example is AADNGAAA. So using the following command, you can fetch details of the external stored procedure:
tdextroutine xsp fetch AADNGAAA
====================== =========================== PROPERTY VALUE ====================== =========================== XSP ID AADNGAAA Database MarketingDB XSP Name XSP_DEMO Source Language JAVA Parameter Style JAVA Routine Kind REGULAR_FUNCTION External Security Protection Mode PROTECTED Parameter UDT IDs Auth ID Used GLOP Set Database Name Create/Replace Job IDs 1702658811851_dca940169df64 ====================== ==========================
tdextroutine xsp fetch AAD%2FGAAA
For details about the options of the tdextroutine xsp fetch command, see tdextroutine External Stored Procedure Subcommands and Options.
Dropping an External Stored Procedure
tdextroutine xsp drop XSP_ID
XSP_ID identifies the external stored procedure. The identifier is returned by the tdextroutine xsp create command or tdextroutine xsp list command. For example, the XSP_ID returned in the previous tdextroutine xsp list example is AADNGAAA. So, using the following command, you can drop the AADNGAAA stored procedure:
tdextroutine xsp drop AADNGAAA
tdextroutine xsp drop AAD%2FGAAA
Instead of specifying XSP_ID, you can also drop an external stored procedure using its name, and optionally the database name, if it is not present in the default database.
tdextroutine xsp drop -d MarketingDB -x XSP_DEMO
For details about the options of the tdextroutine xsp drop command, see tdextroutine External Stored Procedure Subcommands and Options.