Set - 4

Question 11 :

How can I get information about foreign keys used in a table?

Answer :

DatabaseMetaData.getImportedKeys() returns a ResultSet with data about foreign key columns, tables, sequence and update and delete rules.


Question 12 :

Can I use JDBC to execute non-standard features that my DBMS provides?

Answer :

The answer is a qualified yes. As discussed under SQL Conformance: "One way the JDBC API deals with this problem is to allow any query string to be passed through to an underlying DBMS driver. This means that an application is free to use as much SQL functionality as desired, but it runs the risk of receiving an error on some DBMSs. In fact, an application query may be something other than SQL, or it may be a specialized derivative of SQL designed for specific DBMSs (for document or image queries, for example)."
Clearly this means either giving up portability or checking the DBMS currently used before invoking specific operations.


Question 13 :

What is DML?

Answer :

DML is an abbreviation for Data Manipulation Language. This portion of the SQL standard is concerned with manipulating the data in a database as opposed to the structure of a database. The core verbs for DML are SELECT, INSERT, DELETE, UPDATE, COMMIT and ROLLBACK.


Question 14 :

What is the significance of DataBaseMetaData.tableIndexStatistics? How to obtain and use it?

Answer :

To answer the second question first, the tableIndexStatistic constant in the TYPE column will identify one of the rows in the ResultSet returned when DatabaseMetaData.getIndexInfo() is invoked. If you analyze the wordy API, a tableIndexStatistic row will contain the number of rows in the table in the CARDINALITY column and the number of pages used for the table in the PAGES column.


Question 15 :

What types of DataSource objects are specified in the Optional Package?

Answer :

* Basic - Provides a standard Connection object.
* Pooled - Provides a Connection pool and returns a Connection that is controlled by the pool.
* Distributed - Provides a Connection that can participate in distributed transactions ( more than one DBMS is involved). It is anticipated, but not enforced, that a distributed DataSource will also provide pooling.

However, there are no standard methods available in the DataSource class to determine if one has obtained a pooled and/or distributed Connection.