plsql - loadjava seems work but the query doesn't work on oracle sql developer -



plsql - loadjava seems work but the query doesn't work on oracle sql developer -

i trying load java class oracle function. in server managed utilize loadjava below:

class="lang-none prettyprint-override">c:\users\n12017>loadjava -user user1/passw e:\java_repository\soosprojects\mehmet_java_2db_trial\classes\mehmet_java_2db_trial\kondrakk.class

and in oracle db side:

create or replace function ngram_kondrakk(src in varchar2, trg in varchar2) homecoming float language java name 'mehmet_java_2db_trial/kondrakk.getdistance(java.lang.string, java.lang.string) homecoming java.lang.float'; /

however, when apply query below, got error. (as result of query expecting similarity score of 1 since 2 identical strings compared)

select ngram_kondrakk('mehmet','mehmet') dual;

here error:

class="lang-none prettyprint-override">ora-29532: java phone call terminated uncaught java exception: scheme error : java/lang/unsupportedclassversionerror 29532. 00000 - "java phone call terminated uncaught java exception: %s" *cause: java exception or error signaled , not resolved java code. *action: modify java code, if behavior not intended.

finally, here code trying use:

package mehmet_java_2db_trial;

public class kondrakk {

public static float getdistance(string source, string target) { final int sl = source.length(); final int tl = target.length(); if (sl == 0 || tl == 0) { if (sl == tl) { homecoming 1; } else { homecoming 0; } } int n=3; int cost = 0; if (sl < n || tl < n) { (int i=0,ni=math.min(sl,tl);i<ni;i++) { if (source.charat(i) == target.charat(i)) { cost++; } } homecoming (float) cost/math.max(sl, tl); } char[] sa = new char[sl+n-1]; float p[]; //'previous' cost array, horizontally float d[]; // cost array, horizontally float _d[]; //placeholder assist in swapping p , d //construct sa prefix (int i=0;i<sa.length;i++) { if (i < n-1) { sa[i]=0; //add prefix } else { sa[i] = source.charat(i-n+1); } } p = new float[sl+1]; d = new float[sl+1]; // indexes strings s , t int i; // iterates through source int j; // iterates through target char[] t_j = new char[n]; // jth n-gram of t (i = 0; i<=sl; i++) { p[i] = i; } (j = 1; j<=tl; j++) { //construct t_j n-gram if (j < n) { (int ti=0;ti<n-j;ti++) { t_j[ti]=0; //add prefix } (int ti=n-j;ti<n;ti++) { t_j[ti]=target.charat(ti-(n-j)); } } else { t_j = target.substring(j-n, j).tochararray(); } d[0] = j; (i=1; i<=sl; i++) { cost = 0; int tn=n; //compare sa t_j (int ni=0;ni<n;ni++) { if (sa[i-1+ni] != t_j[ni]) { cost++; } else if (sa[i-1+ni] == 0) { //discount matches on prefix tn--; } } float ec = (float) cost/tn; // minimum of cell left+1, top+1, diagonally left , +cost d[i] = math.min(math.min(d[i-1]+1, p[i]+1), p[i-1]+ec); } // re-create current distance counts 'previous row' distance counts _d = p; p = d; d = _d; } // our lastly action in above loop switch d , p, p // has recent cost counts system.out.println(1.0f - (p[sl] / math.max(tl, sl))); homecoming 1.0f - (p[sl] / math.max(tl, sl)); }

}

please help!

thanks in advance...

when compiling java classes load oracle database, sure compile java classes run jvm within oracle database.

the version of java comes oracle database typically out of date compared current java: expect using java 1.4 oracle 10g , 1.5 11g. best bet utilize java compiler ships database, if can't that, utilize -target 1.5 or suchlike forcefulness compiler compile classes run on java 1.5.

plsql oracle-sqldeveloper loadjava

Comments

Popular posts from this blog

model view controller - MVC Rails Planning -

ruby on rails - Devise Logout Error in RoR -

html - Submenu setup with jquery and effect 'fold' -