Path: csiph.com!news.redatomik.org!aioe.org!.POSTED!not-for-mail From: =?UTF-8?Q?Arne_Vajh=c3=b8j?= Newsgroups: comp.lang.java.programmer Subject: Re: Which databases are the most used with Java Date: Thu, 17 Aug 2017 18:11:17 -0400 Organization: Aioe.org NNTP Server Lines: 46 Message-ID: References: <87y3qovwjb.fsf@munus.decebal.nl> <87tw1bx2c9.fsf@munus.decebal.nl> <878tins1li.fsf@munus.decebal.nl> NNTP-Posting-Host: PBuS014lhzVyHjLbXmo/ZQ.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15; format=flowed Content-Transfer-Encoding: 8bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 Content-Language: en-US X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.java.programmer:37263 On 8/17/2017 5:33 PM, Sebastian wrote: > Am 17.08.2017 um 03:21 schrieb Arne Vajhøj: >> On 8/13/2017 4:24 PM, Sebastian wrote: >>> and >>> surprising things can happen, starting with your mapping from database >>> types to Java SQL types (NUMERIC?, REAL?, DECIMAL?... - and this can >>> change even when updating from version of a driver to another of the >>> same vendor). >> >> ???? >> >> JDBC defines mapping for standard types. >> >> NUMERIC and DECIMAL maps to BigDecimal. >> >> REAL maps to float or Float depending on context. > I did not mean that mapping, but the step before it, concerning > metadata: the mapping of database types (what you put in the CREATE > TABLE statement to define the columns) to standard types, i. e. > constants in java.sql.Types. With Oracle, you may get a description of > all supported data types with DatabaseMetadata.getTypeInfo(), or call > DatabaseMetadata.getColumns() on a table. > Metadata is one of the areas where there's little standardization, and > drivers from different vendors differ to a greater extent. In part this > is understandable, because the type inventories differ so much. But even > when types are practically identical between vendors, you may get > different metadata. For example, in SQL Server DECIMAL and NUMERIC are > synonymous in the database, but still they chose to map them to the two > respective Types constants (which have no such synonymity assumption) > instead of choosing the same target for both. In some other databases, > java.sql.Types.NUMERIC is mapped from some integer type. > > Sorry for the lengthy clarification. I'd like to avoid to get > side-tracked in this thread. I just wanted to point out one possible > pitfall in designing a vendor-independent layer above JDBC. Ah. Yes - DDL or code that use DDL data are probably not very portable. Arne