问题描述
我一直在搜索如何在Z / OS(远程)上从db2 8.1.5获取应用程序ID。我发现这个链接:
I have been searching how to get application Id from db2 8.1.5 on Z/OS(remote). I found this link:http://www.ibm.com/developerworks/data/library/techarticle/0302stolze/0302stolze.html
在这个链接中,据说没有内置函数(application_id)在db2之前的8.2获取应用程序ID。所以,我试过解决方案在这个链接中说。但是在以前的链接中尝试SQL函数来注册Java方法时,db2以这种方式警告我:
In this link, it is said that there is not built-in function(application_id) in db2 prior to 8.2 to get application id. So, i tried the solution said in this link. But when trying SQL function in previous link to register the Java method, db2 warns me in this way:
DB21034E该命令作为SQL语句处理,因为它不是一个
有效的命令行处理器命令。在SQL处理期间,它返回:
SQL0104N在之后找到一个意外的令牌FENCED。预计
令牌可能包括:确定,变更。 SQLSTATE = 42601
我尝试的功能:
CREATE FUNCTION application_id()
RETURNS VARCHAR(128)
SPECIFIC applId EXTERNAL NAME 'appl_id.getApplicationId'
NOT FENCED LANGUAGE JAVA PARAMETER STYLE DB2GENERAL
DETERMINISTIC
NO SQL NO EXTERNAL ACTION ALLOW PARALLEL DBINFO
Java方法:
import java.sql.*;
import COM.ibm.db2.app.*;
public class appl_id extends UDF
{
public void getApplicationId(String result) throws Exception
{
try {
// set the output parameter based on DBINFO
set(1, getDBapplid());
}
catch (Exception e) {
setSQLstate("38XXX");
if (e.getMessage().length() > 0) {
setSQLmessage("Exception '" + e.getMessage() +
"' encountered.");
}
else {
setSQLmessage("Exception '" + e.toString() +
"' encountered.");
}
}
}
}
请帮助我
感谢您的支持
推荐答案
根据IBM的DB2 z / OS版本8文档, NOT FENCED
不支持。 DB2通用数据库版本8中支持 NOT FENCED
,如文档。尝试将 NOT FENCED
更改为 FENCED
。
According to IBM's DB2 for z/OS version 8 documentation on CREATE FUNCTION
, NOT FENCED
is not supported. NOT FENCED
is supported in the DB2 Universal Database version 8 as noted in it's CREATE FUNCTION
documentation. Try changing NOT FENCED
to FENCED
.
这篇关于来自db2 8.1.5的Z / OS上的应用程序ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!