SQL Type Codes

Douglas Surber douglas.surber at oracle.com
Fri Jul 6 22:52:37 UTC 2018

JDBCTypes defines a bunch of int constants that "are used to identify generic SQL types”. This is from back before enums were added to the language. The values of these constants are to some extent arbitrary so long as they are distinct. It so happens that the values for some are taken from the SQL spec. ISO 9075-3:2004 (which is the most recent copy of the spec I have) defines a few of these values in section 5, table 6 Codes used for implementation data types in SQL/CLI. Not all of the values are defined in this table and I’m unsure where the others come from.

When SQLType and JDBCType (no ’s’) were added SQLType defies getVendorTypeNumber. The elements of JDBCType return the values of the JDBCTypes constants for the vendor type number. This makes some sense as it allows SQLType and JDBCType to be used in place of JDBCTypes, which is a good thing.

Copying from java.sql.SQLType, jdk.incubator.adba.SqlType also defines getVendorTypeNumber. I was working on jdk.incubator.adba.AdbaType, the enum which defines the standard SQL types, and I realized I couldn’t give a good source for the values for vendor type number. As noted previously the SQL spec only defines some of these values.

My question to the list is, does anyone even care? Is jdk.incubator.adba.SqlType.getVendorTypeNumber needed? There is no need for cross compatibility like between java.sql.SQLType and java.sql.JDBCTypes. Aside from that I see no other use for getVendorTypeNumber and would like to remove it.

If you think it should be included in ADBA speak up. Otherwise I will remove it.


More information about the jdbc-spec-discuss mailing list