About Derby "ERROR 42X51: The class '***' does not exist or is inaccessible. This can hap pen if the class is not public."

本文介绍如何在Apache Derby数据库中安装jar文件并创建用户定义函数(UDF)。通过具体示例展示了安装过程及常见错误解决办法。还提供了查看已安装函数的方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

This link [1] contains a straight forward example to create UDF. Link [2] is the official page to explain difference between Functions and Procedures and other examples. Link [3] lists all data type can be used. Link [5] shows how to add/delete/replace the jar file.


Following is my commands in Derby ij:
call sqlj.install_jar('ed.jar', 'APP.ed',0);
call syscs_util.syscs_set_database_property('derby.database.classpath', 'APP.ed');
create function myED(first_str varchar(50), second_str varchar(50)) returns integer parameter style java no sql language java external name 'EditDistance.LD';


To solve the error, you should put the .java file inside the jar file, especially when you create the jar file using Eclipse. There is an option to do that. Detail is at link [4]. Use this command to show all installed function: “select s.schemaname, f.filename from sys.sysschemas s, sys.sysfiles f  where s.schemaid=f.schemaid; ” Also you can find a copy of the installed jar file under the sub-directory called “jar” within your the database directory.

Reference:
[1] http://www.wisteme.com/question.view?targetAction=viewQuestionTab&id=67
[2] http://wiki.apache.org/db-derby/DerbySQLroutines
[3] http://db.apache.org/derby/docs/10.2/ref/crefsqlj31068.html#crefsqlj31068
[4] http://old.nabble.com/Problems-create-SQL-Function-td23595863.html
[5] http://db.apache.org/derby/docs/10.0/manuals/develop/develop43.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值