Z/OS 上 db2 8.1.5 的应用程序 ID
我一直在搜索如何从 Z/OS(远程)上的 db2 8.1.5 获取应用程序 ID。我找到了这个链接: http://www.ibm.com/developerworks/data/ Library/techarticle/0302stolze/0302stolze.html
在这个链接中,据说没有内置function(application_id) 在 8.2 之前的 db2 中用于获取应用程序 id。所以,我尝试了这个链接中所说的解决方案。但是,当尝试上一个链接中的 SQL 函数来注册 Java 方法时,db2 以这种方式警告我:
DB21034E 该命令被作为 SQL 语句处理,因为它不是 有效的命令行处理器命令。在 SQL 处理过程中,它返回: SQL0104N 在“”之后发现意外的标记“FENCED”。预期的 标记可以包括:“DETERMINISTIC,VARIANT”。 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.");
}
}
}
}
请帮助我。
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
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 The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0104N An unexpected token "FENCED" was found following "". Expected
tokens may include: "DETERMINISTIC, VARIANT". SQLSTATE=42601
The function i tried:
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 Method:
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.");
}
}
}
}
Please help me.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据 IBM 的 DB2 for z/OS 版本 8 文档
CREATE FUNCTION
、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'sCREATE FUNCTION
documentation. Try changingNOT FENCED
toFENCED
.SQL104N 表示你的sql语句不正确。
对于 db2luw 中的调用外部标量函数(我不确定 z/OS),您可以使用 SQLJ.INSTALL_JAR,如下所示
,另请参阅 http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/r0006425.htm
SQL104N means your sql statement is incorrect.
For call external scalar function (I'm not sure about z/OS) in case of db2luw, you can use SQLJ.INSTALL_JAR as below
and see also http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/ad/r0006425.htm