Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Oracle Miscellaneous > Re: Java store ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 6813 of 7279
Post > Topic >>

Re: Java store procedure that reference a external library.

by Luca_DBA <lucaneto@[EMAIL PROTECTED] > Apr 2, 2008 at 10:23 PM

On Apr 2, 11:38 am, aem <a.e.menen...@[EMAIL PROTECTED]
> wrote:
> Hi. I have this problem.
> I can to compile a java store procedure that reference a external
> library.
> I tested this source in eclipse and execute correctly.
> I want to copy a file using SFTP from external server to Oracle
> server.
> I have loaded the external library  "jsch-0.1.37.jar" using javaload,
> and  compiled the java store procedure. But I have problem with the
> load and with the java source.
> The java source not find the external library.
>
> I use:
>
> Oracle 9.0.2.8.0
>
> loadjava -definer -grant plsql -oci8 -resolve -schema tcm -synonym -
> user tcm/tcmp...@[EMAIL PROTECTED]
 -verbose C:\aem\work\jsch-0.1.37.jar
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> create or replace and compile java source named copia_sftp as
> im****t com.jcraft.jsch.*;
>
> /**
>  *  class Copia_Sftp
>  */
> public class Copia_Sftp extends Object
> {
>
>         public static String ejecutar(String host,
>                                                                 String
user,
>                                                                 String
passwd,
>                                                                 int
****t,
>                                                                 String
remote_path,
>                                                                 String
local_path,
>                                                                 String
file_name) {
>
>                 String error = "0";
>                 String message = "";
>
>                 try {
>                         JSch jsch = new JSch();
>
>                         Session session = jsch.getSession(user, host,
****t);
>
>               // Crea una session .
>                         UsuarioSFTP ui = new UsuarioSFTP();
>                         ui.setClave(passwd);
>                         session.setUserInfo(ui);
>                         session.connect();
>
>               // Abre el canal.
>                         Channel channel = session.openChannel("sftp");
>                         channel.connect();
>                         ChannelSftp c = (ChannelSftp) channel;
>
>                         try {
>                                 try {
>                                     c.get(remote_path + file_name,
local_path + file_name);
>                                         return ((new String (error +
message)));
>                                 } catch (SftpException e) {
>                                         e.printStackTrace();
>                                         error = "1";
>                                         message = e.toString();
>                                        
System.out.println(e.toString());
>                                 }
>
>                                 session.disconnect();
>                         } catch (Exception e) {
>                                 e.printStackTrace();
>                                 error = "1";
>                                 message = e.toString();
>                                 System.out.println(e);
>                         }
>                 } catch (Throwable e) {
>                         error = "1";
>                         message = e.toString();
>                         e.printStackTrace();
>                 } finally {
>                         return ((new String (error + message)));
>             }
>         }
>
> }
>
> /**
>  *  class UsuarioSFTP
>  */
> public class UsuarioSFTP implements UserInfo,UIKeyboardInteractive
> {
>
>         private String clave;
>         private String nombre;
>
>         public String getPassphrase() {
>                 return null;
>         }
>
>         public String getPassword() {
>           return clave;
>         }
>
>         public boolean promptPassword(String message) {
>                 return true;
>         }
>
>         public boolean promptPassphrase(String message) {
>                 return true;
>         }
>
>         public boolean promptYesNo(String message) {
>                 return true;
>         }
>
>         public void showMessage(String message) {
>
>         }
>
>         public void setClave(String clave) {
>                 this.clave = clave;
>         }
>
>         public String getNombre() {
>                 return nombre;
>         }
>
>         public void setNombre(String nombre) {
>                 this.nombre = nombre;
>         }
>
>         public String[] promptKeyboardInteractive(String destination,
>                                                                         
               String name,
>                                                                         
               String instruction,
>                                                                         
               String[] prompt,
>                                                                         
               boolean[] echo) {
>
>                 String [] resultado = new String [prompt.length];
>                 resultado [0] = clave;
>                 return resultado;
>         }
>
> }
>
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>
> When I compile the java store procedure.
>
> Compilation errors for JAVA SOURCE COPIA_SFTP
>
> Error: Interface UIKeyboardInteractive of class UsuarioSFTP not
> found.
> Line: 69
> Text: public class UsuarioSFTP implements
> UserInfo,UIKeyboardInteractive
>
> Error: Interface UserInfo of class UsuarioSFTP not found.
> Line: 69
> Text: public class UsuarioSFTP implements
> UserInfo,UIKeyboardInteractive
>
> Error: Class JSch not found.
> Line: 23
> Text: JSch jsch = new JSch();
>
> Thank a lot.
> Alvaro

Hello Alvaro, how are you?
I had this same problem once, and were problems with permissions.
Review the permissions using the views USER_JAVA_POLICY and
DBA_JAVA_POLICY.

Http://download.oracle.com/docs/cd/B10501_01/java.920/a96656/security.htm
# 1002127

Sorry for my poor English.
I hope I have helped you,
Good luck,
Luca.
 




 2 Posts in Topic:
Java store procedure that reference a external library.
aem <a.e.menendez@[EMA  2008-04-02 08:38:21 
Re: Java store procedure that reference a external library.
Luca_DBA <lucaneto@[EM  2008-04-02 22:23:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Mon Dec 1 20:06:36 CST 2008.