150 likes | 315 Views
CS240A Notes on DB Extenders a.k.a. Data Blades, Cartridges, Snap-ins. Carlo Zaniolo Department of Computer Science University of California, Los Angeles. ObjectRelational DBMSs: Extensibility in SQL1999. Large Objects: BLOBs CLOBs. Also locators to large objects
E N D
CS240ANotes on DB Extendersa.k.a. Data Blades, Cartridges, Snap-ins Carlo Zaniolo Department of Computer Science University of California, Los Angeles
ObjectRelational DBMSs: Extensibility in SQL1999 • Large Objects: BLOBs CLOBs. Also locators to large objects • External Functions (User Defined Functions---UDFs): • Defined in C++ or JAVA and linked into DB2. OLEs also supported. • The linchpin of database extenders
UDFs in DB2 • UDFs can be called from SQL, which passes them arguments (e.g., a blob) and and expect a single value back. • UDFs cannot directly access the DB • Scalar functions (no memory), scratchpad functions (memory), table functions (return set of tuples). • No aggregate functions (in DB2) • FENCED, or NOT FENCED (fast and dangerous) • UDFs are Hard to Write and Debug • Impedance mismatch ... many qualifiers: DETERMINISTIC, DBINFO, EXTERNAL ACTION, SCRATCHPAD
Table Functions—DB2 create function salesfunc (timeid int, storeid int) returns table (timeid int, storeid int, sales dec(7,2)) language sql reads sql data no external action deterministic return select timeid, storeid, sum(sales) from salesfact group by timeid, storeid; Table functions return tables that can be joined/selected in SQL select t1.timeid, t1.storeid, t1.sales from time, store, table (cvsample.salesfunc(time.timeid, store.storeid)) as t1 where time.timeid = t1.timeid and store.storeid = t1.storeid; Table functions can also be defined in a C or Java (e.g., to access external files and join them with DB2 tables).
Table Functions—DB2 create function salesfunc (timeid int, storeid int) returns table (timeid int, storeid int, sales dec(7,2)) language sql reads sql data no external action deterministic return select timeid, storeid, sum(sales) from salesfact group by timeid, storeid;
DB2 Image Extender DB2 Audio Extender DB2 Video Extender DB2 Text Extender DB2 Spatial Extender DB2 Video Charger Ext. EcoWin Time Series MapInfo SpatialWare TI Extender Fillmore SQL Expander XML Extender IBM Net Search Ext. IBM Net Search Ext. Prime DES Encryption and Key Management OANDA Currency Ext. Protegrity Secure.Data A Growing List---for DB2 Other vendors have many more
Basics: e.g. Audio Extenders • Import and export audio clips and their attributes into and out of a database. When you import an audio clip, the DB2 Audio Extender stores and maintains audio attributes such as number of audio channels, transfer time, and sampling rate. • Secure and recover audio data. Audio clips and their attributes that you store in a DB2 database are afforded the same security and recovery protection as traditional data. Also access control. • Query audio clips based on related business data or by audio attributes. You can search for audio clips based on data that you maintain, such as a name, number, or description; or by data that the DB2 Audio Extender maintains, such as the format of the audio or the date and time that it was last updated. • Play audio clips. You can use the DB2 Audio Extender to retrieve an audio clip. You can then use the DB2 Audio Extender to invoke your favorite audio browser to play the audio clip. The DB2 Audio Extender supports a variety of audio file formats, such as WAVE and MIDI, and can work with different file-based audio servers.
Extenders’ Architecture • The DB2 Audio Extender defines a new data type and functions for audio • using DB2 Universal Database's built-in support for user-defined types and user-defined functions • It also exploits DB2 UDB's support for large objects of up to 2 gigabytes, and • uses DB2 triggers to provide integrity checking across database tables ensuring the referential integrity of audio data.
Image Extender • Import and export: DB2 Image Extender stores and maintains image attributes such as size in bytes, format, height, width, and number of colors. • Convert the format of images: scale an image, rotate it, do black-white image inversion, compression • Query images by user attributes, DB2-generated attributes or QBIC: QBIC lets you use visual examples of colors or texture patterns as search criteria
DB2 Video Extender • Automatic Scene Change Detection • Video Storyboards
Text Extender • DB2 Text Extender offers a rich set of text search features that allow for more complex and precise queries as well as an improved recall---patent research, legal docs • Dictionary-based linguistic support for many languages such as Arabic, Brazil, Canadian French, Catalan, Danish, Dutch, English (US and UK), Finnish, French, German, Hebrew, Icelandic, Italian, Norwegian, Portugese, Russian, Spanish, Swedish, Swiss German and Thai. • DB2 Net Search Extender contains a DB2 stored procedure that adds the power of fast full-text retrieval
DB2 Spatial Extender • DB2 Spatial Extender allows you to gather spatial data and attach non-spatial business data attributes to it. With the Spatial Extender, your business data and spatial data are now integrated, making the task of creating a GIS as straightforward as creating any other information system. • More integrated than standard extenders
XML Extenders • Extracts XML elements and attributes into traditional SQL data types, leveraging DB2s sophisticated indexing and SQL query • Provides storage, retrieval, and updates of XML documents in a single column • Composes existing DB2 data into XML documents • Stores XML documents as a collection of DB2 data, in multiple columns and tables • Manages your DTD repository • Integrates the powerful search functions of Text Extender for searching one or more sections within a set of XML documents
XML • An Extender • Or the blueprints for future evolution of database systems ?