Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calling Bing translate API in oracle using the LoadJava utility

user13780543Sep 4 2015 — edited Sep 8 2015


Hi ,

We are trying to load the java class into Oracle which does the translation using the Bing API. Here, while using the LoadJava utility, we are specifying the java class which contains the translation code and the Jars which is used by this class.

There was no error while running this command and the Java Class type is in VALID status, but while we are running the function we are getting the below error,

Error :  ORA-29531: no method translator in class BingTranslator

Can anyone help to resolve this issue. I have posted the code used below,

Java Code:

import com.memetix.mst.language.Language;
import com.memetix.mst.translate.Translate;

public class BingTranslator {
  public String translator(String clientID, String clientValue,String value) throws Exception{
   Translate.setClientId(clientID);
      Translate.setClientSecret(clientValue);
      String outValue = Translate.execute(value, Language.AUTO_DETECT, Language.ENGLISH);
   return outValue;
  } 
}

Load Java:

loadjava -u username/password -v -resolve microsoft-translator-java-api-0.6.2.jar microsoft-translator-java-api-0.6.2-jar-with-dependencies.jar BingTranslator.java

Function:

CREATE OR REPLACE FUNCTION FN_translate (clientID VARCHAR2,clientValue VARCHAR2,value VARCHAR2)

   RETURN VARCHAR2

AS LANGUAGE JAVA

   NAME 'BingTranslator.translator(java.lang.String, java.lang.String, java.lang.String) return java.lang.String';

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Oct 6 2015
Added on Sep 4 2015
5 comments
819 views