What Are the Available SQL Types Used by a Database? JDBC

To get the list of available SQL data types used by a database, you can use the DatabaseMetaData.getTypeInfo() method, which retrieves a description of all the standard SQL types supported by this database. This method returns the result as a ResultSet object, which is not very useful for web-based applications. The results of this method are ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC SQL type.

The signature of DatabaseMetaData.getTypeInfo() is

This method retrieves a description of all the standard SQL types supported by this database. They are ordered by DATA_TYPE and then by how closely the data type maps to the corresponding JDBC SQL type.

Each type description has the columns shown in Table.

Table : ResultSet Columns for getTypeInfo()

ResultSet Columns for getTypeInfo()

The Solution

Invoking GetTypes for MySQL

Figure 9-11 shows how to run the solution for the MySQL database.

Invoking GetTypes for MySQLInvoking GetTypes for MySQL

Invoking GetTypes for Oracle

Figure : shows how to run the solution for the Oracle database.

Invoking GetTypes for OracleInvoking GetTypes for Oracle



Face Book Twitter Google Plus Instagram Youtube Linkedin Myspace Pinterest Soundcloud Wikipedia

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

JDBC Topics