information about what is supported, how it behaves, and what type of information exists in the database. The getMetaData method creates a DatabaseMetaData object which provides us with this wealth of information. DatabaseMetaData At over 130 methods, the DatabaseMetaData class is by far the largest. It supplies information about what is supported and how things are supported. It also supplies catalog information such as listing tables, columns, indexes, procedures, and so on. Because the JDBC API specification does an adequate job of explaining the methods contained in this class, and most of them are quite straightforward, we ll just take a look at how the SimpleText driver implements the getTables catalog method. But first, let s review the basic steps needed to implement each of the catalog methods (that is, those methods that return a ResultSet): 1. Create the result columns, which includes the column name, type, and other information about each of the columns. You should perform this step regardless of whether the database supports a given catalog function (such as stored procedures). I believe that it is much better to return an empty result set with only the column information than to raise an exception indicating that the database does not support the function. The JDBC specification does not currently address this issue, so it is open for interpretation. 2. Retrieve the catalog information from the database. 3. Perform any filtering necessary. The application may have specified the return of only a subset of the catalog information. You may need to filter the information in the JDBC driver if the database system doesn t. 4. Sort the result data per the JDBC API specification. If you are lucky, the database you are using will sort the data in the proper sequence. Most likely, it will not. In this case, you will need to ensure that the data is returned in the proper order. 5. Return a ResultSet containing the requested information. The SimpleText getTables method will return a list of all of the text files in the catalog (directory) given. If no catalog is supplied, the default directory is used. Note that the SimpleText driver does not perform all of the steps shown previously; it does not provide any filtering, nor does it sort the data in the proper sequence. You are more than welcome to add this functionality. In fact, I encourage it. One note about column information: I prefer to use a Hashtable containing the column number as the key, and a class
Our facility is located in Orlando, Florida. Our Orlando web hosting data center gives you assurance that your website will work smoothly . Check more in Orlando Web Hosting.