将Apache Commons Codec添加到oracle数据库的步骤

问题描述 投票:0回答:1

此问题未回答。(标记为已回答)

4009777新手4009777 2020年2月5日,上午10:49嗨,

我有Apache通用编解码器库,我需要在oracle11数据库中调用它,以便我可以创建一个利用其中的类的java源,如下所示

使该库包含在数据库中的步骤是什么?

Java file needs to be included in Oracle DB

**代码需要实现,但是找不到符号

CREATE OR REPLACE JAVA SOURCE NAMED "org_apache_Base64" AS
import java.lang.*;
import java.sql.*;
import oracle.sql.*;
import java.io.*;
import javax.xml.bind.DatatypeConverter;
import org.apache.commons.codec.binary.Base64; 

public class org_apache_Base64
{
  public static void ExportBlob(String CONTFILE, BLOB CONTBLOB) throws Exception
  {
  try
  {
    File file = new File("/u01/oracle/jam_export/contract1");
    FileOutputStream fos = new FileOutputStream(file);  
    byte[] encodedBytes = Base64.getEncoder().encode("Test".getBytes());
    System.out.println("encodedBytes " + new String(encodedBytes));
    byte[] decodedBytes = Base64.getDecoder().decode(encodedBytes);
    System.out.println("decodedBytes " + new String(decodedBytes)); 
    System.out.println("PDF File Saved");
    fos.write(decoded); 
    fos.flush();
    fos.close(); 
    }
    catch  (Exception e) 
    {
     System.out.println(e); 
    }
  } };
oracle11g base64 java-6 writetofile
1个回答
0
投票

包含这些依赖项的[Find the jar files,然后使用jar将它们存储在数据库中,以便Oracle可以在其类路径中找到它们。

© www.soinside.com 2019 - 2024. All rights reserved.