SQL Anywhere includes support for six external runtime environments. These include embedded SQL and ODBC applications written in C/C++, and applications written in Java, Perl, PHP, or languages such as C# and Visual Basic that are based on the Microsoft .NET Framework Common Language Runtime (CLR).
SQL Anywhere has had the ability to call compiled native functions written in C or C++ for some time. However, when these procedures are run by the database server, the dynamic link library or shared object has always been loaded by the database server and the calls out to the native functions have always been made by the database server. The risk here is that if the native function causes a fault, then the database server crashes. Running compiled native functions outside the database server, in an external environment, eliminates these risks to the server.
The following is an overview of the external environment support in SQL Anywhere.
The START EXTERNAL ENVIRONMENT and STOP EXTERNAL ENVIRONMENT statements are used to start or stop an external environment on demand. These statements are optional since external environments are automatically started and stopped when needed.
The ALTER EXTERNAL ENVIRONMENT statement is used to set or modify the location of an external environment.
The COMMENT ON EXTERNAL ENVIRONMENT statement is used to add a comment for an external environment.
Once an external environment is set up to be used on the database server, you can then install objects into the database and create stored procedures and functions that make use of these objects within the external environment.
The INSTALL EXTERNAL OBJECT statement is used to install a Perl or PHP external object (for example, a Perl script) from a file or an expression into the database. Once the external objects are installed in the database, they can be used within external stored procedure and function definitions.
The COMMENT ON EXTERNAL ENVIRONMENT OBJECT statement is used to add a comment for an external environment object.
To remove an installed Perl or PHP external object from the database, you use the REMOVE EXTERNAL OBJECT statement.
The CREATE PROCEDURE and CREATE FUNCTION statements are used to create external stored procedure and function definitions. They can be used like any other stored procedure or function in the database. The database server, when encountering an external environment stored procedure or function, automatically launches the external environment (if it has not already been started), and sends over whatever information is needed to get the external environment to fetch the external object from the database and execute it. Any result sets or return values resulting from the execution are returned as needed.
Discuss this page in DocCommentXchange.
|Copyright © 2014, SAP AG or an SAP affiliate company. - SAP Sybase SQL Anywhere 16.0|