談談Oracle interMedia的用法
2024-08-29 13:39:04
供稿:網友
interMedia是Oracle推出的對Oracle8i多媒體功能的擴充,包括image, audio, video三部份。 interMedia使用對象類型,類似于java或C++,來描述image, audio, video類型數據,Oracle在這三類對象中定義了許多方法來操作這些數據,如對于 image類型數據來說,你可以很方便地進行圖形格式轉換,壓縮,拷貝,截取圖形的任何一部份等,而這些是普通LOB類型數據所無法比擬的。
Internet的發展更突出了interMedia在WEB應用中的價值,現有的WEB應用絕大多數將image存在文件系統中,其優點是操作簡單,速度快,缺點是治理復雜,尤其是治理大量image時就受到目錄數等的限制。假如將image保存在數據庫中,由數據庫來統一維護,統一備份,這樣就可以簡化治理。至于存取速度則涉及到整個系統的體系結構,可以通過增加中間層來提高訪問速度。
如何應用interMedia呢?
Oracle提供兩種方法,一種是用jsp和Servlet調用Oracle提供的interMedia JAVA類庫來存取image,其優點是自己可以控制程序,靈活,缺點是復雜,需要自己編寫程序。Oracle提供了例子供大家參考,大家可以到http://technet.oracle.com/sample_co...code_index.htm, 選擇Use Java Servlets & JSPs to load/retrieve rich content。這個例子比較簡單,安裝、運行都有具體說明,我采用的是Tomcat 3.1 for WinNT來運行。
第二種方法就是本文將重點介紹的利用Oracle interMedia Web Agent實現image的上傳和顯示以及如何限制上傳的image的屬性。
什么是Oracle imterMedia Web Agent?
它是用來解析URL來存取多媒體數據,是Oracle提供的用于在WEB上存取多媒體數據的工具,它大大簡化了對多媒體數據的操作,目前支持的WEB Server有:Apache, Oracle application Server, Netscape Server, 以及Microsoft IIS。
Oracle還在NT平臺上提供了一個利用Oracle interMedia Web Agent治理多媒體數據的工具,Oracle 8i interMedia Clipboard, 利用這個工具可以自動生成操作的存儲過程代碼,大家可以將這些代碼作為模板修改,以增強功能。
如何利用Oracle Web Agent來操作image數據呢?
本文將以我在開發WEB項目中的部分程序為例,簡要說明用法,具體的步驟還需要大家仔細閱讀例子安裝說明,如在使用中碰到說明,可以去Oracle愛好者之家的新技術論壇 ,我會盡力回答大家的問題。
關于例子(包括以下文件):
enter_mistore_pict.htm – upload picture page
disp_mistore_pict.htm – display picture page
mistore_upload_test.sql – create table and stored PRocedure script
upload_err.htm – upload image error page
系統要求:
300MHz CPU 128MB memory (256 / 380 for performance), 500MB free disk, CD, sound & video
Windows NT 4.0 SP3 or 5, network software installed
Oracle8i 8.1.5 Server + client software + SQL utilities
Apache Web Server Release 1.3.4 to 1.3.12 for NT
Oracle interMedia Web Agent for NT
Netscape Browser 4.5 or greater or Microsoft Internet EXPlorer 5.0
安裝步驟:
下載本例
以scott/tiger用戶執行mistore_upload_test.sql, create table and stored procedure.
下載并安裝Apache Web Server Release 1.3.4 to 1.3.12 for NT
下載并安裝Oracle interMedia Web Agent for NT, 選擇WEB Server為Apache.
將所有htm考到Apache Web Server的根目錄下,如C:/Program Files/Apache Group/Apache/htdocs。
啟動Apache Web Server
在Web Agent中創建一個test Agent
Open "http:/localhost/intermedia/admin" in your web browser.
Click on Database Agents in the left pane.
Click on Create in the right pane and then type in following values:
agent name:
Test
service:
(Use the service name defined in your tnsnames.ora file.)
database_user:
scott
database_passWord:
tiger
authorized_request_class:
clipboard
authorized_sql_statements:
any
authorized_sql_procedures:
*
Click on Submit at the bottom of the page. Click on Apply.
例子使用說明:
在IE或Netscape中打開http://localhost/enter_mistore_pict.htm.
選擇商店的顏色,輸入你的招呼語,然后點擊Browse…選擇一幅圖代表你的LOGO,注重對圖的限制為:450X100,格式為GIF或JPEG.
點擊upload Logo保存所有信息到stores表中,假如你的圖不合規格則會出錯提示。若一切正常則顯示你的LOGO。
若想了解更多,請參考以下資料
Coloring the Information Superhighway By Douglas Scherer (Oracle Magzine)
Oracle8i interMedia -- Using Oracle8i interMedia with the Web