|
Comments
Did you read today's front page stories & breaking news?
SYS-CON.TV
|
Product Reviews Building Multimedia Repositories
Building Multimedia Repositories
By: Samir Shah
Jun. 1, 2000 12:00 AM
Information repositories are essential. They allow data to be shared within or outside an organization, bringing us closer to the reality of the paperless office. With the toolset shown in Table 1, you can build an enterprise-class, scalable Web-enabled repository that fully incorporates various forms of media. Document files, photographs, video clips and sound files can easily be included in the repository using Java and Oracle8i's LOB (Large Objects) data types. In this article I'm going to focus on how you build a repository to store and search documents such as Microsoft Word, and HTML and XML files stored in a LOB column of a database table. The example used here populates the repository with Microsoft Word résumés, indexes it using Oracle Intermedia and reads it using Java streams from a servlet (see Figure 1).
Benefits of Java and Oracle8i
Working with Large Objects
The Oracle database stores a locator inline with the data. The locator is a pointer to the actual location of the data (LOB value). The LOB data can be stored in the same table or a separate one. The advantage of the locator is that the database doesn't have to scan the LOB data each time it reads multiple rows because only the LOB's locator value is read; the actual LOB data is read only when required. When working with Java and LOBs, first execute the SELECT statement to get the LOB locator, then read or write LOBs using JDBC. (Oracle JDBC driver's type extension classes from oracle.sql package is used to read and write from an Oracle database.) The actual LOB data is materialized as a Java stream from the database, with the locator representing the data in the table. The following code reads the résumé of an employee whose employee number, 7900, is stored in a LOB column called résumé in the sam_emp table.
Statement st = cn.createStatement();
Populating the Repository
st.execute("INSERT INTO sam_emp(empno, resume) Optionally, you may use the java.awt.FileDialog class and java.io package to dynamically select and read a file from your PC. Then load it to a LOB column using the preceding code. The way you search and retrieve documents is independent of how you load the documents. For example, you can store the documents using PL/SQL or SQL*Loader, then search and retrieve using Java servlets. Using PL/SQL, Listing 1 loads an employee's résumé, saved as a Microsoft Word file, to the résumé column of the sam_emp table.
Searching the Repository
Refer to Listing 2 to see how the index is built on the résumé column of the sam_emp table. Once the index is created, the Java applications can search the repository by simply submitting SELECT statements. The MyServletCtx servlet in Listing 3 searches the term passed to it as a parameter in the résumé column of the sam_emp table. The servlet returns the rows matching the search criteria in HTML table format. The employee names in the HTML table are hyperlinked to another servlet, MyServlet, which reads the entire résumé from the database in its original format.
Retrieving from the Repository
Summary
You can also use the Oracle8i database to store, index, parse and transform XML documents. Storing XML documents in the database removes the need to administer and manage multiple repositories for relational and XML data. The Oracle8i's JVM makes it possible to run a Java XML parser in the database. Using the parser, you can parse and transform the XML files inside the database before outputting it to an application server. Reader Feedback: Page 1 of 1
Latest Cloud Developer Stories
Subscribe to the World's Most Powerful Newsletters
Subscribe to Our Rss Feeds & Get Your SYS-CON News Live!
|
SYS-CON Featured Whitepapers
Most Read This Week
Breaking Cloud Computing News
|
|||||||||||||||||||||||||||||||||||||||||||||||||