What Are the Available SQL Data Types? JDBC

If you want to provide table-creation services from GUI database applications, then you may need to provide available SQL data types for databases. The DatabaseMetaData interface contains methods that list the available SQL types used by a database. The method getAvailableSqlTypes() retrieves the SQL data types supported by a database and driver. How do you get the name of a JDBC type? The following method implements a convenient way to convert a java.sql.Types integer value into a printable name. This method, which is useful for debugging purposes, uses reflection to get all the field names from java.sql.Types. It then retrieves their values and creates a map of values to names.

Testing getAvailableSqlTypes(): Using a MySQL Database

Testing getAvailableSqlTypes(): Using an Oracle Database

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

JDBC Topics