Principles and prospects of Oracle processing of multimedia information (1)

Source: Internet
Author: User
Tags sql using

For a long time, multimedia information has been stored in the computer as files and managed by the operating system. However, with the development of computer networks and distributed computing, multimedia information has been efficiently managed and accessed, query has become an urgent requirement. Relational databases have powerful data management capabilities. Combined with the two aspects, multimedia databases emerged. This article will give a summary of Oracle's multimedia information processing methods, tools, features and some basic principles.

However, we can't help but regret to see that the existing database has limited operation capabilities for some multimedia data. Performance Tuning for multimedia databases has now encountered new problems. Even so, multimedia databases still have broad application values and prospects.

Of course, this article cannot cover all aspects. For details about Oracle multimedia information processing, please refer to the relevant Oracle manual.

I. Application Prospects

With the increase in computer processing capabilities, multimedia has already been integrated into the computer. If multimedia is missing, there is a lack of images, audios, and videos from multiple sources, it is hard to imagine that computers will enter thousands of households today. For a long time, multimedia information has been stored in the computer as files and managed by the operating system. However, with the development of computer networks and distributed computing, Oracle is a famous database vendor, multimedia Information processing is at the forefront. This article will give a summary of Oracle's multimedia information processing methods, tools, features and some basic principles. Hope to inspire readers. Of course, there are many other relational databases. Although the development tools and programming interface statements vary, the data types and processing methods are similar. So we skipped it here.

II. Introduction to multimedia data types

In relational databases, large objects such as multimedia information are accessed by lob fields. This standard was officially introduced in Oracle8i to meet the needs of multimedia large object processing. In Oracle databases, lob data includes the following types:

Clob: similar to the long type of Oracle7, clob can store single-byte data.

Nclob: Nclob stores multi-byte National Character Set Data with a fixed width.

Blob: similar to the long raw type in Oracle7. Unstructured binary data can be stored. Oracle8 does not explain this data, but stores and retrieves it in the original form.

Bfile: Bfile allows read-only access to large binary files stored outside the Oracle database. Unlike the other three lob data types, bfile data is stored in a separate file, which is not maintained by Oracle.

Features:

1. In Oracle7, the corresponding long or long raw field has a limit of 2 GB, while the lob limit is 4 GB.

2. lob can be manipulated by calling the interface OCI or by pl/SQL using the dbms_lob package.

3. Unlike the long type, lob has only one field at most in each table. It can have multiple fields and use the trigger features.

4. lob data processing can obtain the same things and features as other data.

5. the storage of lob is special. It is not stored in the same database table as other data, but can be separately stored in different tablespaces, with a locator pointing to the actual lob data.

Iii. Examples of large multimedia Object Access routines

Follow these steps:

1) Create a database table first:

create table lobdemo(key NUMBER KEY,   clob_col CLOB,blob_col BLOB,bifle_col BFILE);
 

The first column of the database stores a code, and the other three columns store lob data.

2) After the table is created, insert a data entry to the table:

 insert intolobdemo(key,clob_col,blob_col,bfile_col) values(10,'abcdefghijklmnopqrsatuvwxyzasdffasfsdS',empty_blob(),null);
 

In this data, we insert a string in the second column, which is formatted as clob data for storage. In the second column, we use the empty_blob function to initialize a locator, later, you can obtain the locator for operations such as select and update. The third column is assigned a null value and does not obtain a locator, which is different from the empty_blob function.

3) query the data in the inserted Table

 select blob_col from boldemo where key=20;
 

Note: The returned results of this SQL statement are locator, rather than the actual data.

4) modify data in the database

 

 update lobdemo SET blob_col='aedevbagddgagdfdfasasdfdsa' where key=10;

From these SQL statements, we can see the basic lob-type data processing method, and find that it is similar to other types of data processing. However, lob data processing in SQL statements is special in the following aspects:

1) Processing bfile:

The bfile type has its own particularity, which is different from clob and blob. The actual data files are stored outside the operating system. Therefore, there are two features: 1. No transactional Control 2. bfile is read-only and cannot be modified using dbms_lob or oracl8 oci. Let's take a look at the bfile operation steps:

<1> to access external files, the server must know the location of the files in the operating system. Next we will create a directory:

create DIRECTORY utils AS '/home/utils';

Utils indicates the directory logic name. '/home/utils' indicates the actual directory.

<2> use the bfilename function to insert a row of data:

 insert into lobdemo(key,bfile_col)    values (-1,biflename('utils','file1')); 

The first parameter of the bfilename function is the logical directory name, and the second parameter is the file name. Note: This line inserts a lob locator pointing to/home/utils/file1, not the file itself.


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.