Sunday, August 26, 2012

DB2 存储过程执行原理

一直认为存储过程应该是直接经过数据库的SQL编译器去执行,但是DB2却不是这样的,解释:
DB2© Universal Database#x2122 stored procedures are written in SQL Procedural Language (SQLPL). When DB2 UDB compiles a stored procedure, it first converts the SQLPL to C, and then compiles the resulting C program into a DLL (dynamic link library). When it's time to run the procedure, DB2 loads the DLL into memory, and calls the main entry point of the DLL.

上面这段话说的是DB2存储过程使用SQLPL语言,编译时先将SQLPL转换成C然后编译成DLL,当调用存储过程时DB2直接载入DLL到内存中执行。

因为这个原因所以DB2的环境中需要有C语言编译器。

link:
http://www.ibm.com/developerworks/data/library/techarticle/0306haungs/0306haungs.html

No comments:

Post a Comment