SQL Type Codes

Lance Andersen lance.andersen at oracle.com
Sat Jul 7 01:00:40 UTC 2018

Yes,  JDBCType provided a mapping to Types.java which dates to JDBC 1.0.  There is no need to include the vendor type numbers in ADBA.  

The original Type constants mapped to SQL92 spec.  Types that were defined but not in SQL 92 were given negative values.  After running into issues with some vendors also using negative values, it was decided to use 20xxx for new types.

Anyways, yes for ADBA, the type values are not needed to be carried over.

> On Jul 6, 2018, at 6:52 PM, Douglas Surber <douglas.surber at oracle.com> wrote:
> 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.
> Douglas

 <http://oracle.com/us/design/oracle-email-sig-198324.gif> <http://oracle.com/us/design/oracle-email-sig-198324.gif>
 <http://oracle.com/us/design/oracle-email-sig-198324.gif>Lance Andersen| Principal Member of Technical Staff | +1.781.442.2037
Oracle Java Engineering 
1 Network Drive 
Burlington, MA 01803
Lance.Andersen at oracle.com <mailto:Lance.Andersen at oracle.com>

More information about the jdbc-spec-discuss mailing list