Three File Upload technologies in Oracle

Source: Internet
Author: User
Tags oracle developer

The ORACLE tutorial is about three File Upload technologies in Oracle.

There are multiple ways to upload files to the database or Server File System in Oracle. Here we mainly introduce the following three types: The mod_plsql module of Oracle HTTP Server (OHS) provides the ability to upload files to the database through web pages; the tag library of Oracle 9iAS and the file upload function provided by Bean; upload files through JDBC programs.

1. The mod_plsql module of Oracle HTTP Server (OHS) provides the ability to upload files to databases through web pages.

1. Create a document access table in the target mode of File Upload


The CONTENT_TYPE column in the table is BLOB or long raw, but only one column is allowed. Each uploaded file occupies a single row in the table and cannot upload multiple files to the same row in the table at the same time. This is where the mod_plsql module has limited functions. Create a document table: Content_table.


2. Configure the document access table for DAD

After starting the database and OHS, create a blank database access descriptor. Upload/download documents to the database associated with the database access descriptor on the "Gateway use Document Table" page. By default, all documents are uploaded as BLOB. You can overwrite this default setting by specifying a comma-separated file extension in the Long Raw field. The * value of this field will allow all documents to be uploaded as Long Raw. "Document access process" specifies the virtual path used to access the document. The "document access process" field specifies the process in which the gateway processes the document request. The default document table is content_table.

3. The file upload page is provided. The stored procedure is used to upload, browse, and download files.


4. Provides the Upload File browsing page

The files submitted in step 1 are automatically uploaded to the document table. The Stored Procedure WRITE_INFOS is used to record the information of the uploaded files. In fact, this is completely unnecessary, but we will make a comparison here.


After reading the document table, you will find that the file has been uploaded, but the upload time of the Document Table is incorrect, which is inconsistent with the system time in the upload record. This may be a BUG in this function, if anyone has a solution or software patch, please let me know.

5. Provides page browsing for uploaded files


In this way, you can browse the file based on the mime_type of the uploaded file in the Web browser.

This method is the easiest to upload files. It supports Chinese file names and uploading and downloading client files. It can automatically identify the file type and calculate the file size.

[NextPage]

Ii. File Upload functions provided by the tag library and Bean of Oracle 9iAS

In Oracle developer suit 9i, July 9031 uploads files through the tag library. In the following example, the in_file.jsp file provides an upload form. up_file.jsp lists the uploaded files. The dn_file.jsp file downloads the files just uploaded. This method uses a Graphical Editor, which is simple and feasible, but does not support Chinese file names. It can upload and download client files.

The source program of in_file.jsp is as follows:


Source program of up_file.jsp:


Source code of dn_file.jsp:


3. Implement file upload and download through JDBC

By uploading files to BLOB or CLOB columns, you can upload files. However, this method does not support uploading files on the client. Therefore, it has many limitations, the download function implemented through JDBC is only downloaded locally on the server (the download program is not listed). Therefore, this method is only used as a technical reference and has no practical value.

The program Blob_in_stream.jsp is as follows:


The program Blob_w_stream.jsp is as follows:

Previous Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.