| Oracle8i interMedia Using Oracle8i interMedia with the Web Release 8.1.5.2 A77033-01 |
|
This chapter describes how to use the drag-and-drop interface of Oracle8i interMedia Clipboard to retrieve Oracle8i interMedia objects from a database and to store and update Oracle8i interMedia objects in a database. It describes the following:
Before you can use the Clipboard, you must add the ORDWEBUTL package to each database you plan to access. The package installs catalog tables, which help the Clipboard keep track of the names of columns containing multimedia objects, primary key columns, PL/SQL procedures, and the types of multimedia objects supported by the Clipboard. For information on adding the package, see the online Read Me file.
You invoke Oracle8i interMedia Clipboard from the Windows NT Program menu. Choose Oracle for Windows NT -> Oracle interMedia -> Oracle interMedia Clipboard.
When you invoke Oracle8i interMedia Clipboard, the Connect box prompts you for the name of a Web Agent. Enter the following information:
/intermedia.
Click Connect.
Oracle8i interMedia Clipboard connects to the Web server and Oracle8i interMedia Web Agent. Then, it prompts you for the user name and password for the agent list. The information you specify must match the agent_list_user and agent_list_password configuration parameters in the Web Agent section of the configuration file. (For information on the configuration file, see Section 2.1.4.) If the information matches, Oracle8i interMedia Clipboard lists the database agents authorized for clipboard access.
Oracle8i interMedia Clipboard helps you easily capture, store, and retrieve multimedia Web objects. The Clipboard has three primary views:
In the following figure, the Clipboard displays the expanded list of database agents and tables in the Navigator Tree, the rows and columns of a table named GRAPHICS in the Table View, and an Oracle8i interMedia object (an image) with the GRAPHIC_ID of 10002 in the Object View:
To use Oracle8i interMedia Clipboard and Web Agent to insert or update multimedia objects in a database, follow these general steps:
See Section 3.6 for information about inserting new multimedia objects into the database. See Section 3.7 for information about updating multimedia objects in the database.
To use Oracle8i interMedia Clipboard and Web Agent to retrieve multimedia objects from a database, follow these general steps:
The object types ORDImage, ORDAudio, ORDVideo, and ORDVir contain an attribute for the last modification date of the object. Before displaying an object, Oracle8i interMedia Clipboard reads the attribute. If the last modification date of the object is more recent than the date of the object stored in the Web browser cache, Oracle8i interMedia Clipboard retrieves the contents of the multimedia object from the database. If the last modification date of the object is earlier than the date of the object stored in cache, Oracle8i interMedia Clipboard displays the object stored in cache.
If you are using the ORDImgB object type, the Oracle8i interMedia Clipboard Code Wizard asks you to name a column as the last-modification-date column. If you do not specify such a column, Oracle8i interMedia Clipboard always retrieves the contents of the multimedia object from the database. (Note that browsers use the last-modification-date column or attribute in a similar way.)
See Section 3.8 for more information about retrieving multimedia objects.
For the exercises in this chapter, assume that you have a database agent named EMP_CLIP. The configuration file defines it as having a request class of clipboard and a retrieve_database_agent named empdb_read. The database agent EMP_CLIP can access the database table named EMPLOYEE_PIC, which contains the following columns:
The following figure shows the Clipboard as it displays the EMPLOYEE_PIC table, which currently contains no rows:
Before you can use Oracle8i interMedia Clipboard to retrieve, insert, or update multimedia objects in a table, you must create PL/SQL procedures for that table using the Code Wizard.
The procedures specify the information needed to process the request, including the content type, content length, and HTTP status. For more information about the PL/SQL procedures and their parameters, see Section 4.2.
To create the procedures, take these steps:
EMP_CLIP agent. Oracle8i interMedia Clipboard displays the tables to which the database agent has access.
INSERT_EMP_ROW.
UPDATE_EMP_ROW.
If multimedia objects are stored in more than one column in the table, you can select more than one column.
GET_EMP_PIC. Click Next.
PUT_EMP_PIC. Click Next.
SET_EMP_PIC. Click Next.
If you specified that multimedia objects are to be stored in more than one column in Step 13, the Clipboard prompts you for Get Object, Put Object, and Set Object procedures for those columns.
The Code Wizard creates the procedures and displays information about success of its actions.
If the procedures already exist, you can use the Code Wizard to replace them with new versions, delete them, or leave them as they are.
If you are using the ORDImgB object type, the Code Wizard asks you to select the last-modification-date column. (If your table does not contain such a column, leave this blank.) If you use such a column, note that you should not select it in the steps that create the insert and update procedures. The procedure created by Oracle8i interMedia Clipboard populates this column.
Using Oracle8i interMedia Clipboard, you can store Oracle8i interMedia objects in a database.
If you have not generated PL/SQL procedures for the table, you must use the Code Wizard to do so. See Section 3.5 for step-by-step directions.
For this exercise, assume that you want to use Oracle8i interMedia Clipboard to insert a new row into the EMPLOYEE_PIC table and to store the employee's picture into the new row. The picture currently resides in a file.
To store a new row, take these steps:
EMP_CLIP agent to see the list of tables. Double-click the EMPLOYEE_PIC table. Oracle8i interMedia Clipboard displays the Table View. Currently, it contains no rows.
20012, for the EMP_ID column and click OK.
diamon, for the EMP_NAME column and click OK.
rubin, for the MGR_NAME column and click OK.
Oracle8i interMedia Clipboard displays the Object View for the row you inserted.
You can insert more than one row at a time by choosing Table -> Insert Multiple Rows.
To store the Oracle8i interMedia object into the row, take these steps:
You can load the Oracle8i interMedia object into the Object View using one of the following methods:
Note that the object is not loaded into the database at this point.
If you wish, you can edit the object by selecting the Edit tab. (See Section 3.10 for more information.)
The Table View now looks like this:
Using Oracle8i interMedia Clipboard, you can update Oracle8i interMedia objects in a database.
If you have not generated PL/SQL procedures for the table, you must use the Code Wizard to do so. See Section 3.5 for step-by-step directions.
In this exercise, you update the employee picture that you stored in the previous section. Take these steps:
Update the Oracle8i interMedia object in the Object View of Oracle8i interMedia Clipboard. You can update the Oracle8i interMedia object in several ways:
Note that the object is not loaded into the database at this point.
Using Oracle8i interMedia Clipboard, you can retrieve Oracle8i interMedia objects from a database and drag the objects into a Web authoring tool. Oracle8i interMedia Clipboard generates a URL for the object and adds it to the page in the Web authoring tool.
If you have not generated PL/SQL procedures for the table, you must use the Code Wizard to do so. See Section 3.5 for step-by-step directions.
In this exercise, you retrieve a multimedia object from the database and drag the object into a Web authoring tool. Take these steps:
EMP_CLIP agent to see a list of tables. Double-click the EMPLOYEE_PIC table. Oracle8i interMedia Clipboard displays the Table View.)
For example, if you drag an image in Embed mode, Oracle8i interMedia Clipboard passes the <IMG SRC> tag to the HTML code. The <IMG SRC> tag contains a URL that points to the object in the database. When you view the page in a browser or Web authoring tool, Oracle8i interMedia Web Agent decodes the URL, retrieves the image from the database, and displays the image.
For example, if you drag an image in Link mode, Oracle8i interMedia Clipboard passes the <A HREF> tag to the HTML code. The <A HREF> tag contains a URL that points to the object in the database and the text that is displayed as the link. You can edit the link text in the Web authoring tool. When you view the page in a browser or Web authoring tool, the browser or Web authoring tool displays the link text. When you click the link, Oracle8i interMedia Web Agent decodes the URL, retrieves the image from the database, and displays the image.
Oracle8i interMedia Clipboard passes the <IMG SRC> tag to the Web authoring tool. The <IMG SRC> tag contains a URL that points to the object in the database. For example, if you select the object from a row with the EMP_ID of 20012, Oracle8i interMedia Clipboard generates the following HTML tag:
<img src="http://imedia.ora.com:8007/intermedia/empdb_read/mediaget/ GET_EMP_PIC/20012" width="250" height="300">
The parts of the URL that follow intermedia indicate the following:
For more information about the URL format, see Section 3.9.
Now, you can continue to author your Web page using your Web authoring tool.
When you view the page in a browser or Web authoring tool, Oracle8i interMedia Web Agent decodes the URL, retrieves the image from the database, and displays the image.
When you use Oracle8i interMedia Clipboard to retrieve Oracle8i interMedia objects from a database and drag the objects into a Web authoring tool, the Clipboard constructs a URL. In the same way, when you use Oracle8i interMedia Clipboard to store or update Oracle8i interMedia objects in a database, the Clipboard constructs a URL.
Oracle8i interMedia Clipboard constructs the URLs using the following format:
http://domain:port/intermedia/agent_name/request_mode/proc_name/path_info
You use the same format when you use a Web application to retrieve, store, or update multimedia data.
Table 3-1 shows the meaning of the parts of the URL format.
The following example, which retrieves a photograph of an employee, shows a URL that uses the agent empdb_read, the PL/SQL procedure GET_EMP_PIC, and the employee ID 20013.
http://www.orcl.com:8001/intermedia/empdb_read/mediaget/get_emp_pic/20013
In addition to using a PL/SQL procedure, you can use an anonymous PL/SQL block or a SQL statement passed as a parameter to the request mode. You use the ord_sql variable name to pass the statement. However, note that PL/SQL anonymous blocks and SQL statements may not be as efficient as PL/SQL procedures.
The following example shows a URL that uses a SQL statement to retrieve an image:
http://www.orcl.com:8001/intermedia/empdb_read/mediaget?ord_sql= select+t.picture.GetContent()+as+ord_content_blob,+ t.picture.GetMimeType()+as+ord_content_type,+ t.picture.GetContentLength()+as+ord_content_length+ from+employee_pic+twhere+t.emp_id%3d20013
The URL must be on one line. It is shown here on multiple lines for readability.
You cannot specify a SQL statement as a component of the path in a URL. You can specify one only as a query string or POST data variable. For more information about POST data variables, see Section 4.2.1.
Note that when you store data using Oracle8i interMedia Clipboard, it generates additional information in the URL that sets the properties of the data after it is stored in the database. For information about the URL format and setting the properties when you store data using an application, such as a Web form, rather than Oracle8i interMedia Clipboard, see Section 4.1.
You can edit Oracle8i interMedia objects through Oracle8i interMedia Clipboard. The Object View contains an Edit tab from which you can specify the editing software you want to use and from which you can invoke the software.
For example, you can select an image from a database, and, from the Object View, invoke image editing software. After making the changes to the image, you can load the modified image into the database.
The following steps describe how to edit an image:
EMP_CLIP agent to see a list of tables. Double-click the EMPLOYEE_PIC table. Oracle8i interMedia Clipboard displays the Table View.
To refine the result set that is shown in the Table View, you can specify a query for the table using the Query and Sort dialog box. It displays the columns in the table on which you can base a condition or sort order. This is especially useful when the table contains a great many rows.
Note, because you cannot base a condition or sort order on an Oracle8i interMedia object, the Oracle8i interMedia column does not appear in this dialog box.
To specify a query and sort order, take these steps:
(After each selection, press the Enter key to register the value.)
For example, if the table contains the column ID with a numeric data type, you can specify the greater than or equal to operator (>=) and a value of 2000 for the ID column. Oracle8i interMedia Clipboard generates a SQL query with the condition WHERE ID >= 2000.
You can enter more than one condition for a particular column by clicking More and then specifying another operator and another value.
For information about the listed operators, see Oracle8i SQL Reference.
You can enter more than one condition for a particular column by clicking More and then specifying another operator and another value. Oracle8i interMedia Clipboard combines the conditions with an OR operator.
You can enter conditions for more than one column. Oracle8i interMedia Clipboard combines the conditions with an AND operator.
When you use more than one condition for a column, Oracle8i interMedia Clipboard uses separate pages for each condition. It groups the first condition for each column on the same page. You can display the previous page by clicking Previous. You can display the next page by clicking Next.
For example, assume you have two columns, ID and JOB_CODE, both numeric columns. You want a query that gives you rows where the ID is less than 2000 or greater than 5000 and the JOB_CODE is greater than 670 (to represent managers). You enter the conditions in the following way:
2000.
670. You now have the first page of conditions. Oracle8i interMedia Clipboard constructs the condition WHERE ID < 2000 AND JOB_CODE > 670.
5000.
670.
You now have the second page of conditions. Oracle8i interMedia Clipboard constructs the condition WHERE ID > 5000 AND JOB_CODE >= 670.
You can view the previous page by clicking Previous.
Oracle8i interMedia Clipboard puts the two pages of conditions together and constructs a query with the following conditions:
WHERE (ID < 2000 AND JOB_CODE > 670) OR (ID > 5000 AND JOB_CODE > 670)