<?xml version="1.0" encoding="ISO-8859-15"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
  distributed with this work for additional information
  regarding copyright ownership.  The ASF licenses this file
  to you under the Apache License, Version 2.0 (the
  "License"); you may not use this file except in compliance
  with the License.  You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing,
  software distributed under the License is distributed on an
  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  KIND, either express or implied.  See the License for the
  specific language governing permissions and limitations
  under the License.
-->
<!DOCTYPE document PUBLIC "-//APACHE//DTD Documentation V2.0//EN" "http://forrest.apache.org/dtd/document-v20.dtd">
<document> 
  <header> 
    <title>Database support in DdlUtils</title> 
  </header> 
  <body>
    <p>
      DdlUtils accesses databases via JDBC, esp. the metadata that JDBC provides, as well as by
      accessing database specific tables and performin database specific SQL. The details of the
      latter can be found in the support documentation for the individual databases.
    </p>
    <p>
      The main source of information about JDBC is the <a href="ext:java/jdbc/spec">JDBC Specification</a>,
      currently for JDBC version 3. General information about the JDBC datatypes can also be found in
      <a href="ext:java/jdbc/guide/types">Chapter 9: Mapping SQL and Java Types</a> of the
      <a href="ext:java/jdbc/guide">JDBC Technology Guide: Getting Started</a>. Please also note
      that some JDBC types are only available in recent versions of the Java platform, e.g.
      the <code>BOOLEAN</code> type is only available since J2SE version 1.4. These will be
      usable with DdlUtils only if you're running the respective Java version or a newer one.
    </p>
    <p>
      Here is a short summary of the information about the JDBC data types:
    </p>
    <p>&nbsp;</p>
    <table>
      <tr>
        <th>JDBC data type</th>
        <th>Format, Range, Size</th>
        <th>Comments</th>
      </tr>
      <tr>
        <td>ARRAY</td>
        <td></td>
        <td>Represents an array</td>
      </tr>
      <tr>
        <td>BIGINT</td>
        <td>-9223372036854775808 to 9223372036854775807</td>
        <td>64 bit signed integer</td>
      </tr>
      <tr>
        <td>BINARY</td>
        <td>254 bytes</td>
        <td></td>
      </tr>
      <tr>
        <td>BIT</td>
        <td>0, 1</td>
        <td></td>
      </tr>
      <tr>
        <td>BLOB</td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td>BOOLEAN</td>
        <td>true, false</td>
        <td>Java 1.4 and above</td>
      </tr>
      <tr>
        <td>CHAR</td>
        <td>254 (8-bit characters)</td>
        <td></td>
      </tr>
      <tr>
        <td>CLOB</td>
        <td></td>
        <td></td>
      </tr>
      <tr>
        <td>DATALINK</td>
        <td></td>
        <td>Java 1.4 and above. References a file outside of the database but that
            is managed by it. Maps to <code>java.net.URL</code></td>
      </tr>
      <tr>
        <td>DATE</td>
        <td>year, month, day</td>
        <td></td>
      </tr>
      <tr>
        <td>DECIMAL</td>
        <td>15 for precision (total number of digits) and for scale (number of
            digits after the decimal point)</td>
        <td></td>
      </tr>
      <tr>
        <td>DISTINCT</td>
        <td></td>
        <td>Represents a distinct value, totally implementation dependent</td>
      </tr>
      <tr>
        <td>DOUBLE</td>
        <td>15 bits of mantissa (fractional part)</td>
        <td></td>
      </tr>
      <tr>
        <td>FLOAT</td>
        <td>15 bits of mantissa (fractional part)</td>
        <td></td>
      </tr>
      <tr>
        <td>INTEGER</td>
        <td>-2147483648 to 2147483647</td>
        <td>32 bit signed integer</td>
      </tr>
      <tr>
        <td>JAVA_OBJECT</td>
        <td></td>
        <td>Represents an java object, usually a serialized one</td>
      </tr>
      <tr>
        <td>LONGVARBINARY</td>
        <td>1 GB</td>
        <td></td>
      </tr>
      <tr>
        <td>LONGVARCHAR</td>
        <td>1 GB (8-bit characters)</td>
        <td></td>
      </tr>
      <tr>
        <td>NULL</td>
        <td></td>
        <td>Is not specified in detail</td>
      </tr>
      <tr>
        <td>NUMERIC</td>
        <td>15 for precision (total number of digits) and for scale (number of digits
            after the decimal point)</td>
        <td></td>
      </tr>
      <tr>
        <td>OTHER</td>
        <td></td>
        <td>Entirely database-specific type</td>
      </tr>
      <tr>
        <td>REAL</td>
        <td>7 bits of mantissa (fractional part)</td>
        <td></td>
      </tr>
      <tr>
        <td>REF</td>
        <td></td>
        <td>Represents a reference to an instance of a SQL structured type. Maps to
            <code>java.sql.Ref</code>.</td>
      </tr>
      <tr>
        <td>SMALLINT</td>
        <td>-32768 to 32767</td>
        <td>16 bit signed integer</td>
      </tr>
      <tr>
        <td>STRUCT</td>
        <td></td>
        <td>Represents a structured type, usually created via CREATE TYPE. Maps to
            <code>java.sql.Struct</code>.</td>
      </tr>
      <tr>
        <td>TIME</td>
        <td>hours, minutes, seconds</td>
        <td></td>
      </tr>
      <tr>
        <td>TIMESTAMP</td>
        <td>year, month, day, hours, minutes, seconds, nanoseconds</td>
        <td></td>
      </tr>
      <tr>
        <td>TINYINT</td>
        <td>-128 to 127 (8 bit signed) or 0 to 254 (8 bit unsigned)</td>
        <td>8 bit signed or unsigned integer</td>
      </tr>
      <tr>
        <td>VARBINARY</td>
        <td>254 bytes</td>
        <td></td>
      </tr>
      <tr>
        <td>VARCHAR</td>
        <td>254 bytes (8-bit characters)</td>
        <td></td>
      </tr>
    </table>
  </body>
</document>
