Explain the embedded SQL coupling approach and its different types
SQL queries are embedded and integrated into standard programming language.
Preprocessor translates SQL to calls of specific library (early query compilation, vendor-specific)
Static versus dynamic (character sequences can be interpreted as queries)
What is the Call-Level-Interface (CLI) approach?
Standard library functions used through an API -> dynamic approach. Allows portability and vendor-independence.
Explain the advantages and disadvantages of CLI and embedded SQL as coupling approaches
Embedded: nice integration with prog. lang. (syntax, variables), but vendor-specific. Static emb. can perform early compilation (check, optimization).
CLI: vendor-independence and dynamic queries (also in dynamic. emb.), but late compilation (optimization not possible, cannot check errors) and not so straight-forward integration with prog. language.
What are the requeriments for standard CLIs?
What are the requirements imposed by distributed systems on DB-gateways?
Support for remote access
Access multiple DBs through separate (simultaneous) heterogeneous DB connections (driver manager).
- - Access the same or different DBs, within the same distributed transaction.
Support vendor-specific extensions.
Give an overview of the programming model of JDBC.
Standard Java CLI, derived from ODBC.
- Abstraction layer between Java applications and SQL
Additional: transaction (for single connection): implicit begin metadata lookup
Explain the general JDBC architecture and the DataSource mechanism
DataSource: alternative 3, abstract vendor-specific details of the connection (URL)
Architecture: application -> driver manager -> (vendor) driver
- Driver processes CLI calls and redirects SQL statements to DBMS. Hides heterogeneity of data source (DB, flat file, etc…) manages connection, error handling, data type mapping.
What are the goals of a driver manager and the types of driver in ODBC?
Manages indirection between application and vendor dirver (n:m mapping)
1-tier driver: complete DB functionality on driver (flat files/desktop DBs): no multi-user / transaction.
2-tier driver: client/server model
3-tier driver: middleware server: relays requests to one or more DBMSs.
Give an overview of the different types of JDBC drivers
(Partial Java)
(All (pure) Java)
Explain the programming model of SQLJ
SQL code embedded in JAva, generates JDBC with preprocessor. Translator (profile) + customizer (vendor DB; uses java introspection). Bin-portability.
Context object is referred in the SQL code (contains connection)
Input and results are placed in Java variables
What are the advantages and disadvantages of SQLJ over JDBC?
SQLJ
JDBC (DB-gateway)
How do iterators work in SQLJ?
Access to rows returned by query (~cursor)
Specific iterator class generated by precomp. (strongly typed)
Named iterator: gives names to iterator members (columns)
Positioned iterator: name does not matter, just types and positions are used
Explain the concept of binary portability in SQLJ
Addition to source code portability (explores portability of Java)
Uses generic precompiler: Java + JDBC
Profile is generic and accessible to any customer (enhances the program with vendor-specific stubs (invocation of access routine))