<html>
<head>
    <base href="https://docs.jboss.org/author">
            <link rel="stylesheet" href="/author/s/en/2172/19/5/_/styles/combined.css?spaceKey=TEIID&amp;forWysiwyg=true" type="text/css">
    </head>
<body style="background: white;" bgcolor="white" class="email-body">
<div id="pageContent">
<div id="notificationFormat">
<div class="wiki-content">
<div class="email">
    <h2><a href="https://docs.jboss.org/author/display/TEIID/JDBC+Translator">JDBC Translator</a></h2>
    <h4>Page <b>edited</b> by             <a href="https://docs.jboss.org/author/display/~shawkins">Steven Hawkins</a>
    </h4>
        <br/>
                         <h4>Changes (2)</h4>
                                 
    
<div id="page-diffs">
                    <table class="diff" cellpadding="0" cellspacing="0">
    
            <tr><td class="diff-snipped" >...<br></td></tr>
            <tr><td class="diff-unchanged" > <br>{note} <br></td></tr>
            <tr><td class="diff-changed-lines" >The translator implements INSERT/UPDATE through the Phoenix UPSERT operation.  This means you can see different behavior than with standard <span class="diff-changed-words">INSER<span class="diff-deleted-chars"style="color:#999;background-color:#fdd;text-decoration:line-through;">t</span><span class="diff-added-chars"style="background-color: #dfd;">T</span>/UPDATE</span> - such as repeated inserts will not throw a duplicate key exception, but will instead update the row in question. <br></td></tr>
            <tr><td class="diff-unchanged" >{note} <br> <br></td></tr>
            <tr><td class="diff-added-lines" style="background-color: #dfd;">{note} <br>Due to Phoenix driver limitations the importer will not look for unique constraints and defaults to not importing foreign keys. <br>{note} <br> <br></td></tr>
            <tr><td class="diff-unchanged" >h3. _hive_ <br> <br></td></tr>
            <tr><td class="diff-snipped" >...<br></td></tr>
    
            </table>
    </div>                            <h4>Full Content</h4>
                    <div class="notificationGreySide">
        <h1><a name="JDBCTranslator-JDBCTranslator"></a>JDBC Translator</h1>

<p>The JDBC translator bridges between SQL semantic and data type difference between Teiid and a target RDBMS. Teiid has a range of specific translators that target the most popular open source and proprietary databases.</p>

<h3><a name="JDBCTranslator-jdbcansi"></a><em>jdbc-ansi</em></h3>

<p>Declares support for most SQL constructs supported by Teiid, except for row limit/offset and EXCEPT/INTERCECT. Translates source SQL into ANSI compliant syntax. This translator should be used when another more specific type is not available.</p>

<h3><a name="JDBCTranslator-jdbcsimple"></a><em>jdbc-simple</em></h3>

<p>Same as jdbc-ansi, except disables support for function, UNION, and aggregate pushdown.</p>

<h3><a name="JDBCTranslator-access"></a><em>access</em></h3>

<p>For use with Microsoft Access 2003 or later.  If used in a dynamic vdb the importer defaults to importKeys=false and excludeTables=.*[.]MSys.&#42; to avoid issues with the metadata provided by the JDBC ODBC bridge.  You may need to adjust these values if you use a different JDBC driver.</p>

<h3><a name="JDBCTranslator-db2"></a><em>db2</em></h3>

<p>For use with DB2 8 or later and DB2 for i 5.4 or later.</p>

<p>DB2 specific execution properties:</p>
<ul>
        <li><em>DB2ForI</em>&#45; indicates that the the DB2 instance is DB2 for i. Defaults to false.</li>
        <li><em>supportsCommonTableExpressions</em>&#45; indicates that the DB2 instance supports Common Table Expressions.  Defaults to true. Some older versions, or instances running in a conversion mode, of DB2 lack full common table expression support and may need support disabled.</li>
</ul>


<h3><a name="JDBCTranslator-derby"></a><em>derby</em></h3>

<p>For use with Derby 10.1 or later.</p>

<h3><a name="JDBCTranslator-excelodbc"></a><em>excel-odbc</em></h3>

<p>For use with Excel 2003 or later via the JDBC-ODBC bridge.</p>

<h3><a name="JDBCTranslator-greenplum"></a><em>greenplum</em></h3>

<p>For use with the Greenplum database.</p>

<h3><a name="JDBCTranslator-h2"></a><em>h2</em></h3>

<p>For use with H2 version 1.1 or later.</p>

<h3><a name="JDBCTranslator-hana"></a><em>hana</em></h3>

<p>For use with SAP Hana.</p>

<h3><a name="JDBCTranslator-ApacheHBaseTranslator"></a>Apache HBase Translator</h3>

<p>The Apache HBase Translator is exposes querying functionality to <a href="http://hbase.apache.org/" class="external-link" rel="nofollow">HBase</a> Tables. <a href="http://phoenix.apache.org/" class="external-link" rel="nofollow">Apache Phoenix </a> is a JDBC SQL interface for HBase - see <a href="/author/display/TEIID/Phoenix+Data+Sources" title="Phoenix Data Sources">Phoenix Data Sources</a> that is required for this translator as it pushes down commands into <a href="http://phoenix.apache.org/language/index.html" class="external-link" rel="nofollow">Phoenix SQL</a>.</p>

<p>The DatabaseTimezone property should not be used with this translator.</p>

<p>The HBase Translator doesn't support Joins. Phoenix uses the HBase Table Row ID as the Primary Key, which map to . This Translator is developed with Phoenix 4.3+ for HBase 0.98.1+.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The translator implements INSERT/UPDATE through the Phoenix UPSERT operation.  This means you can see different behavior than with standard INSERT/UPDATE - such as repeated inserts will not throw a duplicate key exception, but will instead update the row in question.</td></tr></table></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Due to Phoenix driver limitations the importer will not look for unique constraints and defaults to not importing foreign keys.</td></tr></table></div>

<h3><a name="JDBCTranslator-hive"></a><em>hive</em></h3>

<p>For use with Hive v.10 and SparkSQL v1.0 and later.</p>

<p>Hive has limited support for data types. It is does not have native support for time/xml or LOBs. These limitations are reflected in the translator capabilities. A Teiid view can use these types, however the transformation would need to specify the necessary conversions. Note that in those situations, the evaluations will be done in Teiid engine.</p>

<p>Hive only supports EQUI join, so using any other joins types on its source tables will result in inefficient queries.</p>

<p>To write criteria based on partitioned columns, modeled them on source table, but do not include them in selection columns.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The Hive importer does not have concept of catalog or source schema, nor does it import keys, procedures, indexes, etc.</td></tr></table></div>

<p>Hive specific importer properties:</p>
<ul>
        <li><em>trimColumnNames</em>&#45; For Hive 0.11.0 and later the the DESCRIBE command metadata is <a href="https://issues.jboss.org/browse/TEIID-2524" class="external-link" rel="nofollow">inappropriately returned with padding</a>, set to true to strip trim white space from column names. Defaults to false.</li>
</ul>


<p>*<em>useDatabaseMetaData</em>&#45; For Hive 0.13.0 and later the normal JDBC DatabaseMetaData facilities are sufficient to perform an import.  Set to true to use the normal import logic with the option to import index information disabled.  Defaults to false.  When true, trimColumnNames has no effect.  </p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>If false the typical JDBC DatabaseMetaData calls are not used so not all of the common JDBC importer properties are applicable to Hive.  You may still use excludeTables regardless.</td></tr></table></div>

<div class='panelMacro'><table class='tipMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/check.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>"Database Name"</b><br />When the database name used in the Hive is different than "default", the metadata retrieval and execution of queries does not work as expected in Teiid, as Hive JDBC driver seems to be implicitly connecting (tested with &lt; 0.12) to "default" database, thus ignoring the database name mentioned on connection URL. This can workaround in the Teiid in JBoss AS environment by setting the following in data source configuration.
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
    &lt;new-connection-sql&gt;use {database-name}&lt;/new-connection-sql&gt;
</pre>
</div></div>
<p>This is fixed in &gt; 0.13 version Hive Driver. See <a href="https://issues.apache.org/jira/browse/HIVE-4256" class="external-link" rel="nofollow">https://issues.apache.org/jira/browse/HIVE-4256</a></p></td></tr></table></div>

<h3><a name="JDBCTranslator-hsql"></a><em>hsql</em></h3>

<p>For use with HSQLDB 1.7 or later.</p>

<h3><a name="JDBCTranslator-impala"></a><em>impala</em></h3>

<p>For use with Cloudera Impala 1.2.1 or later.</p>

<p>Impala has limited support for data types. It is does not have native support for time/date/xml or LOBs. These limitations are reflected in the translator capabilities. A Teiid view can use these types, however the transformation would need to specify the necessary conversions. Note that in those situations, the evaluations will be done in Teiid engine.</p>

<p>Impala only supports EQUI join, so using any other joins types on its source tables will result in inefficient queries.</p>

<p>To write criteria based on partitioned columns, modeled them on source table, but do not include them in selection columns.</p>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Impala Hive importer does not have concept of catalog or source schema, nor does it import keys, procedures, indexes, etc.</td></tr></table></div>

<p>Impala specific importer properties:<br/>
*<em>useDatabaseMetaData</em>&#45; Set to true to use the normal import logic with the option to import index information disabled.  Defaults to false.  </p>
<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>If false the typical JDBC DatabaseMetaData calls are not used so not all of the common JDBC importer properties are applicable to Impala.  You may still use excludeTables regardless.</td></tr></table></div>

<div class='panelMacro'><table class='noteMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/warning.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>Some versions of Impala requires the use of a LIMIT when performing an ORDER BY.  If no default is configured in Impala, then an exception can occur when a Teiid query with an ORDER BY but no LIMIT is issued.  You should set an Impala wide default, or configure the connection pool to use a new connection sql string to issue a SET DEFAULT_ORDER_BY_LIMIT statement. See the <a href="http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/Installing-and-Using-Impala/ciiu_langref_sql.html?scroll=limit_unique_1" class="external-link" rel="nofollow">Cloudera docs</a> for more on limit options - such as controlling what happens when the limit is exceeded.</td></tr></table></div>

<h3><a name="JDBCTranslator-ingres"></a><em>ingres</em></h3>

<p>For use with Ingres 2006 or later.</p>

<h3><a name="JDBCTranslator-ingres93"></a><em>ingres93</em></h3>

<p>For use with Ingres 9.3 or later.</p>

<h3><a name="JDBCTranslator-intersystemscache"></a><em>intersystems-cache</em></h3>

<p>For use with Intersystems Cache Object database (only relational aspect of it)</p>

<h3><a name="JDBCTranslator-informix"></a><em>informix</em></h3>

<p>For use with any Informix version.</p>

<h3><a name="JDBCTranslator-metamatrix"></a><em>metamatrix</em></h3>

<p>For use with MetaMatrix 5.5.0 or later.</p>

<h3><a name="JDBCTranslator-modeshape"></a><em>modeshape</em></h3>

<p>For use with Modeshape 2.2.1 or later. The PATH, NAME, LOCALNODENAME, DEPTH, and SCORE functions should be accessed as pseudo-columns, e.g. "nt:base"."jcr:path". Teiid UFDs (prefixed by JCR_) are available for CONTIANS, ISCHILDNODE, ISDESCENDENT, ISSAMENODE, REFERENCE - see the JCRFunctions.xmi. If a selector name is needed in a JCR function, you should use the pseudo-column "jcr:path", e.g. JCR_ISCHILDNODE(foo.jcr_path, 'x/y') would become ISCHILDNODE(foo, 'x/y') in the ModeShape query. An additional pseudo-column "mode:properties" should be imported by setting the ModeShape JDBC connection property teiidsupport=true. The column "mode:properties" should be used by the JCR_REFERENCE and other functions that expect a .&#42; selector name, e.g. JCR_REFERENCE(nt_base.jcr_properties) would become REFERENCE("nt:base".*) in the ModeShape query.</p>

<h3><a name="JDBCTranslator-mysqlmysql5"></a><em>mysql</em> <em>mysql5</em></h3>

<p>For use with MySQL version 4.x and 5 or later respectively.  Also compatible with backwards compatible MySQL derivatives, including MariaDB.</p>

<p>The MySQL Translators expect the database or session to be using ANSI mode. If the database is not using ANSI mode, an initialization query should be used on the pool to set ANSI mode:</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">set SESSION sql_mode = 'ANSI'</pre>
</div></div>

<p>If you may deal with null timestamp values, then set the connection property zeroDateTimeBehavior=convertToNull.  Otherwise you'll get conversion errors in Teiid that '0000-00-00 00:00:00' cannot be converted to a timestamp.</p>

<h3><a name="JDBCTranslator-netezza"></a><em>netezza</em></h3>

<p>For use with any Netezza version.</p>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>The current Netezza vendor supplied JDBC driver performs poorly with single transactional updates.  As is generally the case when possible use batched updates.</td></tr></table></div>

<p>Netezza specific execution properties:</p>
<ul>
        <li><em>SqlExtensionsInstalled</em>&#45; indicates that SQL Extensions including support fo REGEXP_LIKE are installed. Defaults to false.</li>
</ul>


<h3><a name="JDBCTranslator-oracle"></a><em>oracle</em></h3>

<p>For use with Oracle 9i or later.</p>

<p>Sequences may be used with the Oracle translator. A sequence may be modeled as a table with a name in source of DUAL and columns with the name in source set to{{&lt;sequence name&gt;.[nextval&#124;currval].}}</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Teiid 8.4 and Prior Oracle Sequence DDL</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN TABLE seq (nextval integer OPTIONS (NAMEINSOURCE 'seq.nextval'), currval integer options (NAMEINSOURCE 'seq.currval') ) OPTIONS (NAMEINSOURCE 'DUAL')
</pre>
</div></div>

<p>With Teiid 8.5 it's no longer necessary to rely on a table representation and Oracle specific handling for sequences.  See <a href="/author/display/TEIID/DDL+Metadata" title="DDL Metadata">DDL Metadata</a> for representing currval and nextval as source functions.</p>

<p>You can also use a sequence as the default value for insert columns by setting the column to autoincrement and the name in source to&nbsp;<tt>&lt;element name&gt;:SEQUENCE=&lt;sequence name&gt;.&lt;sequence value&gt;</tt>.</p>

<p>A rownum column can also added to any Oracle physical table to support the rownum pseudo-column. A rownum column should have a name in source of&nbsp;<tt>rownum</tt>. These rownum columns do not have the same semantics as the Oracle rownum construct so care must be taken in their usage.</p>

<p>Out parameters for procedures may also be used to return a result set, if this is not represented correctly by the automatic import you need to manually create a result set and represent the output parameter with native type "REF CURSOR".</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>DDL for out parameter result set</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
create foreign procedure proc (in x integer, out y object options (native_type 'REF CURSOR')) 
returns table (a integer, b string) 
</pre>
</div></div>

<p>Oracle specific importer properties:</p>
<ul>
        <li><em>useGeometryType</em>&#45; Use the Teiid Geomety type when importing columns with a source type of SDO_GEOMETRY. Defaults to false.</li>
        <li><em>useIntegralTypes</em>&#45; Use integral types rather than decimal when the scale is 0. Defaults to false.</li>
</ul>


<p>Oracle specific execution properties:</p>
<ul>
        <li><em>OracleSuppliedDriver</em>&#45; indicates that the Oracle supplied driver (typically prefixed by ojdbc) is being used. Defaults to true. Set to false when using DataDirect or other Oracle JDBC drivers.</li>
</ul>


<h5><a name="JDBCTranslator-GeoSpatialfunctionsupport"></a>Geo Spatial function support</h5>

<p>Oracle translator supports geo spatial functions. The supported functions are:</p>

<p>Relate = sdo_relate</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN FUNCTION sdo_relate (arg1 string,  arg2 string,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_relate (arg1 Object,  arg2 Object,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_relate (arg1 string,  arg2 Object,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_relate (arg1 Object,  arg2 string,  arg3 string) RETURNS string;
</pre>
</div></div>

<p>Nearest_Neighbor = sdo_nn</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN FUNCTION sdo_nn (arg1 string,  arg2 Object,  arg3 string,  arg4 integer) RETURNS string;
CREATE FOREIGN FUNCTION sdo_nn (arg1 Object,  arg2 Object,  arg3 string,  arg4 integer) RETURNS string;
CREATE FOREIGN FUNCTION sdo_nn (arg1 Object,  arg2 string,  arg3 string,  arg4 integer) RETURNS string;
</pre>
</div></div>

<p>Within_Distance = sdo_within_distance</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN FUNCTION sdo_within_distance (arg1 Object,  arg2 Object,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_within_distance (arg1 string,  arg2 Object,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_within_distance (arg1 Object,  arg2 string,  arg3 string) RETURNS string;
</pre>
</div></div>

<p>Nearest_Neigher_Distance = sdo_nn_distance</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN FUNCTION sdo_nn_distance (arg integer) RETURNS integer;
</pre>
</div></div>

<p>Filter = sdo_filter</p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
CREATE FOREIGN FUNCTION sdo_filter (arg1 Object,  arg2 string,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_filter (arg1 Object,  arg2 Object,  arg3 string) RETURNS string;
CREATE FOREIGN FUNCTION sdo_filter (arg1 string,  arg2 object,  arg3 string) RETURNS string;
</pre>
</div></div>

<h3><a name="JDBCTranslator-postgresql"></a><em>postgresql</em></h3>

<p>For use with 8.0 or later clients and 7.1 or later server.</p>

<p>PostgreSQL specific execution properties:</p>
<ul>
        <li><em>PostGisVersion</em>&#45; indicate the PostGIS version in use. Defaults to 0 meaning PostGIS is not installed.  Will be set automatically if the database version is not set.</li>
        <li>_ProjSupported&#45; boolean indicating if Proj is support for PostGis. Will be set automatically if the database version is not set.</li>
</ul>


<h3><a name="JDBCTranslator-prestodb"></a><em>prestodb</em></h3>

<p>The PrestoDB translator, known by the type name&nbsp;<em>prestodb</em>, exposes querying functionality to PrestoDB Data Sources.  In data integration respect, PrestoDB has very similar capabilities of Teiid, however it goes beyond in terms of distributed query execution with multiple worker nodes. Teiid's execution model is limited to single execution node and focuses more on pushing the query down to sources. Currently Teiid has much more complete query support and many enterprise features.</p>

<p>The PrestoDB translator supports only SELECT statements with a restrictive set of capabilities. This translator is developed with 0.85 version of PrestoDB and capabilities are designed for this version. With new versions of PrestoDB  Teiid will adjust the capabilities of this translator. Since PrestoDB exposes a relational model, the usage of this is no different than any RDBMS source like Oracle, DB2 etc. For configuring the PrestoDB consult the PrestoDB documentation.</p>

<h3><a name="JDBCTranslator-sqlserver"></a><em>sqlserver</em></h3>

<p>For use with SQL Server 2000 or later. A SQL Server JDBC driver version 2.0 or later (or compatible e.g. JTDS 1.2 or later) should be used.&nbsp; The SQL Server DatabaseVersion property may be set to 2000, 2005, 2008, or 2012, but otherwise expects a standard version number - e.g. "10.0".</p>

<p>SQL Server specific execution properties:</p>
<ul>
        <li><em>JtdsDriver</em>&#45; indicates that the open source JTDS driver is being used. Defaults to false.</li>
</ul>


<h3><a name="JDBCTranslator-sybase"></a><em>sybase</em></h3>

<p>For use with Sybase version 12.5 or later.</p>

<p>If used in a dynamic vdb and no import properties are specified (not recommended, see import properties below), then exceptions can be thrown retrieving system table information.  You should specify a schemaPattern or use excludeTables to exclude system tables if this occurs.</p>

<p>If the name in source metadata contains quoted identifiers (such as required by reserved words or words containing characters that would not otherwise be allowed) and you are using a jconnect Sybase driver, you must first configure the connection pool to enable <b>quoted_identifier</b>:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Driver URL with SQLINITSTRING</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
jdbc:sybase:Tds:host.at.some.domain:5000/db_name?SQLINITSTRING=set quoted_identifier on
</pre>
</div></div>

<p>If you are a jconnect Sybase driver and will target the source for dependent joins, you should allow the translator to send more values by setting the JCONNECT_VERSION.  Otherwise you will get exceptions with statements that have more than 481 bind values:</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Driver URL with JCONNECT_VERSION</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: java; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
jdbc:sybase:Tds:host.at.some.domain:5000/db_name?SQLINITSTRING=set quoted_identifier on&amp;JCONNECT_VERSION=6
</pre>
</div></div>

<p>Sybase specific execution properties:</p>
<ul>
        <li><em>JtdsDriver</em>&#45; indicates that the open source JTDS driver is being used. Defaults to false.</li>
</ul>


<h3><a name="JDBCTranslator-sybaseiq"></a><em>sybaseiq</em></h3>

<p>For use with Sybase IQ version 15.1 or later.</p>

<h3><a name="JDBCTranslator-teiid"></a><em>teiid</em></h3>

<p>For use with Teiid 6.0 or later.</p>

<h3><a name="JDBCTranslator-teradata"></a><em>teradata</em></h3>

<p>For use with Teradata V2R5.1 or later.</p>

<p>With Teradata driver version 15 date, time, and timestamp values by default will be adjusted for the Teiid server timezone.  To remove this adjustment, set the translator DatabaseTimezone property to GMT or whatever the Teradata server defaults to.</p>

<h3><a name="JDBCTranslator-vertica"></a><em>vertica</em></h3>

<p>For use with Vertica 6 or later.</p>

<h3><a name="JDBCTranslator-ActianVectorinHadoop"></a><em>Actian Vector in Hadoop</em></h3>

<p>For use <a href="http://esd.actian.com/Express/readme_HSE_2.0.html" class="external-link" rel="nofollow">Actian Vector in Hadoop</a>, download the JDBC driver at <a href="http://esd.actian.com/platform" class="external-link" rel="nofollow">http://esd.actian.com/platform</a>. Note the port number in connection URL is "AH7" which maps to 16967.</p>

<h2><a name="JDBCTranslator-ExecutionPropertiessharedbyallJDBCTranslators"></a>Execution Properties - shared by all JDBC Translators</h2>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'> DatabaseTimeZone </td>
<td class='confluenceTd'> The time zone of the database. Used when fetchings date, time, or timestamp values. </td>
<td class='confluenceTd'> The system default time zone </td>
</tr>
<tr>
<td class='confluenceTd'> DatabaseVersion </td>
<td class='confluenceTd'> The specific database version. Used to further tune pushdown support. </td>
<td class='confluenceTd'> The base supported version or derived from the DatabaseMetadata.getDatabaseProductVersion string.  Automatic detection requires a Connection.  If there are circumstances where you are getting an exception from capabilities being unavailable (most likely due to an issue obtaining a Connection), then set DatabaseVersion property.  Use the JDBCExecutionFactory.usesDatabaseVersion() method to control whether your translator requires a connection to determine capabilities. </td>
</tr>
<tr>
<td class='confluenceTd'> TrimStrings </td>
<td class='confluenceTd'> true to trim trailing whitespace from fixed length character strings. Note that Teiid only has a string, or varchar, type that treats trailing whitespace as meaningful. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> UseBindVariables </td>
<td class='confluenceTd'> true to indicate that PreparedStatements should be used and that literal values in the source query should be replace with bind variables. If false only LOB values will trigger the use of PreparedStatements. </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> UseCommentsInSourceQuery </td>
<td class='confluenceTd'> This will embed a leading comment with session/request id in the source SQL for informational purposes. Can be customized with the CommentFormat property. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> CommentFormat </td>
<td class='confluenceTd'> <a href="http://docs.oracle.com/javase/7/docs/api/java/text/MessageFormat.html" class="external-link" rel="nofollow">MessageFormat</a> string to be used if UseCommentsInSourceQuery is enabled.  Available properties:
<ul>
        <li>0 - session id string</li>
        <li>1 - parent request id string</li>
        <li>2 - request part id string</li>
        <li>3 - execution count id string</li>
        <li>4 - user name string</li>
        <li>5 - vdb name string</li>
        <li>6 - vdb version integer</li>
        <li>7 - is transactional boolean</li>
</ul>
</td>
<td class='confluenceTd'> /<b>teiid sessionid:{0}, requestid:{1}.{2}</b>/ </td>
</tr>
<tr>
<td class='confluenceTd'> MaxPreparedInsertBatchSize </td>
<td class='confluenceTd'> The max size of a prepared insert batch. </td>
<td class='confluenceTd'> 2048 </td>
</tr>
<tr>
<td class='confluenceTd'> StructRetrieval </td>
<td class='confluenceTd'> Struct retrieval mode can be one of OBJECT - getObject value returned, COPY - returned as a <tt>SerialStruct</tt>, ARRAY - returned as an <tt>Array</tt>) </td>
<td class='confluenceTd'> OBJECT </td>
</tr>
<tr>
<td class='confluenceTd'> EnableDependentJoins </td>
<td class='confluenceTd'> For sources that support temporary tables (DB2, Derby, H2, HSQL 2.0+, MySQL 5.0+, Oracle, PostgreSQL, SQLServer, Sybase) allow dependent join pushdown </td>
<td class='confluenceTd'> false </td>
</tr>
</tbody></table>
</div>


<h2><a name="JDBCTranslator-ImporterPropertiessharedbyallJDBCTranslators"></a>Importer Properties - shared by all JDBC Translators</h2>

<p>When specifying the importer property, it must be prefixed with "importer.".   Example:   importer.tableTypes</p>

<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<th class='confluenceTh'> Name </th>
<th class='confluenceTh'> Description </th>
<th class='confluenceTh'> Default </th>
</tr>
<tr>
<td class='confluenceTd'> catalog </td>
<td class='confluenceTd'> See DatabaseMetaData.getTables [1] </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> schemaPattern </td>
<td class='confluenceTd'> See DatabaseMetaData.getTables [1] </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> tableNamePattern </td>
<td class='confluenceTd'> See DatabaseMetaData.getTables [1] </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> procedureNamePattern </td>
<td class='confluenceTd'> See DatabaseMetaData.getProcedures [1] </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> tableTypes </td>
<td class='confluenceTd'> Comma separated list - without spaces - of imported table types. See DatabaseMetaData.getTables [1] </td>
<td class='confluenceTd'> null </td>
</tr>
<tr>
<td class='confluenceTd'> excludeTables&nbsp; <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> A case-insensitive regular expression that when matched against a fully qualified table name [2] will exclude it from import.&nbsp; Applied after table names are retrieved.&nbsp; Use a negative look-ahead (?&#33;&lt;inclusion pattern&gt;).&#42; to act as an inclusion filter. </td>
<td class='confluenceTd'> null&nbsp; <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> excludeProcedures&nbsp; <br class="atl-forced-newline" /> </td>
<td class='confluenceTd'> A case-insensitive regular expression that when matched against a fully qualified procedure name [2] will exclude it from import.&nbsp; Applied after procedure names are retrieved.&nbsp; Use a negative look-ahead (?&#33;&lt;inclusion pattern&gt;).&#42; to act as an inclusion filter. </td>
<td class='confluenceTd'> null&nbsp; <br class="atl-forced-newline" /> </td>
</tr>
<tr>
<td class='confluenceTd'> useFullSchemaName </td>
<td class='confluenceTd'> When false, directs the importer to drop the source catalog/schema from the Teiid object name, so that the Teiid fully qualified name will be in the form of &lt;model name&gt;.&lt;table name&gt; - Note: when false this may lead to objects with duplicate names when importing from multiple schemas, which results in an exception.&nbsp; This option does not affect the name in source property. </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> importKeys </td>
<td class='confluenceTd'> true to import primary and foreign keys - NOTE foreign keys to tables that are not imported will be ignored </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> autoCreateUniqueConstraints </td>
<td class='confluenceTd'> true to create a unique constraint if one is not found for a foreign keys </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> importIndexes </td>
<td class='confluenceTd'> true to import index/unique key/cardinality information </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> importApproximateIndexes </td>
<td class='confluenceTd'> true to import approximate index information. See DatabaseMetaData.getIndexInfo [1] </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> importProcedures </td>
<td class='confluenceTd'> true to import procedures and procedure columns - Note that it is not always possible to import procedure result set columns due to database limitations. It is also not currently possible to import overloaded procedures. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> widenUnsignedTypes </td>
<td class='confluenceTd'> true to convert unsigned types to the next widest type. For example SQL Server reports tinyint as an unsigned type. With this option enabled, tinyint would be imported as a short instead of a byte. </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> quoteNameInSource </td>
<td class='confluenceTd'> false will override the default and direct Teiid to create source queries using unquoted identifiers. </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> useProcedureSpecificName </td>
<td class='confluenceTd'> true will allow the import of overloaded procedures (which will normally result in a duplicate procedure error) by using the unique procedure specific name as the Teiid name. This option will only work with JDBC 4.0 compatible drivers that report specific names. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> useCatalogName </td>
<td class='confluenceTd'> true will use any non-null/non-empty catalog name as part of the name in source, e.g. "catalog"."schema"."table"."column", and in the Teiid runtime name if useFullSchemaName is also true. false will not use the catalog name in either the name in source or the Teiid runtime name. Should be set to false for sources that do not fully support a catalog concept, but return a non-null catalog name in their metadata - such as HSQL. </td>
<td class='confluenceTd'> true </td>
</tr>
<tr>
<td class='confluenceTd'> useQualifiedName </td>
<td class='confluenceTd'> true will use name qualification for both the Teiid name and name in source as dictated by the useCatalogName and useFullSchemaName properties.&nbsp; Set to false to disable all qualification for both the Teiid name and the name in source, which effectively ignores the useCatalogName and useFullSchemaName properties.&nbsp; Note: when false this may lead to objects with duplicate names when importing from multiple schemas, which results in an exception. </td>
<td class='confluenceTd'> true&nbsp; <br class="atl-forced-newline" /> </td>
</tr>
</tbody></table>
</div>

<p>[1] JavaDoc for&nbsp;<a href="http://java.sun.com/javase/6/docs/api/java/sql/DatabaseMetaData.html" class="external-link" rel="nofollow">DatabaseMetaData</a><br/>
[2] The fully qualified name for exclusion is based upon the settings of the translator and the particulars of the database. All of the applicable name parts used by the translator settings (see useQualifiedName and useCatalogName)  including catalog, schema, table will be combined as catalogName.schemaName.tableName with no quoting.  For example Oracle does not report a catalog, so the name used with default settings for comparison would be just schemaName.tableName.</p>
<div class='table-wrap'>
<table class='confluenceTable'><tbody>
<tr>
<td class='confluenceTd'> useAnyIndexCardinality </td>
<td class='confluenceTd'> true will use the maximum cardinality returned from DatabaseMetaData.getIndexInfo.  importKeys or importIndexes needs to be enabled for this setting to have an effect.  This allows for better stats gathering from sources that don't support returning a statistical index. </td>
<td class='confluenceTd'> false </td>
</tr>
<tr>
<td class='confluenceTd'> importStatistics </td>
<td class='confluenceTd'> true will use database dependent logic to determine the cardinality if none is determined.  Not yet supported by all database types - currently only supported by Oracle and MySQL. </td>
<td class='confluenceTd'> false </td>
</tr>
</tbody></table>
</div>


<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td><b>Warning</b><br />The default import settings will crawl all available metadata. This import process is time consuming and full metadata import is not needed in most situations. Most commonly you'll want to limit the import by at least schemaPattern and tableTypes.</td></tr></table></div>
<p>Example importer settings to only import tables and views from my-schema.  See also <a href="/author/display/TEIID/VDB+Definition" title="VDB Definition">VDB Definition</a></p>
<div class="code panel" style="border-width: 1px;"><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: xml; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
&lt;model ...

  &lt;property name="importer.tableTypes" value="TABLE,VIEW"/&gt;
  &lt;property name="importer.schemaPattern" value="my-schema"/&gt;
  ...
&lt;/model&gt;
</pre>
</div></div>

<h2><a name="JDBCTranslator-Usage"></a>Usage</h2>

<p>Usage of a JDBC source is straight-forward. Using Teiid SQL, the source may be queried as if the tables and procedures were local to the Teiid system.</p>

<h3><a name="JDBCTranslator-NativeQueries"></a>Native Queries</h3>

<p>Physical tables, functions, and procedures may optionally have native queries associated with them.&nbsp; No validation of the native query is performed, it is simply used in a straight-forward manner to generate the source SQL.&nbsp; For a physical table setting the teiid_rel:native-query extension metadata will execute the native query as an inline view in the source query.&nbsp; This feature should only be used against sources that support inline views.&nbsp; The native query is used as is and is not treated as a parameterized string. For example on a physical table y with nameInSource="x" and teiid_rel:native-query="select c from g", the Teiid source query"SELECT c FROM y" would generate the SQL query "SELECT c FROM (select c from g) as x".&nbsp; Note that the column names in the native query must match the nameInSource of the physical table columns for the resulting SQL to be valid.</p>

<p>For physical procedures you may also set the teiid_rel:native-query extension metadata to a desired query string with the added ability to positionally reference IN parameters - see&nbsp;<a href="/author/display/TEIID/Translators#Translators-native">Parameterizable Native Queries</a>.&nbsp; The teiid_rel:non-prepared extension metadata property may be set to false to turn off parameter binding.&nbsp; Note this option should be used with caution as inbound may allow for SQL injection attacks if not properly validated.&nbsp; The native query does not need to call a stored procedure.&nbsp; Any SQL that returns a result set positionally matching the result set expected by the physical stored procedure metadata will work.&nbsp; For example on a stored procedure x with teiid_rel:native-query="select c from g where c1 = $1 and c2 = '$$1'", the Teiid source query "CALL x&#40;?)" would generate the SQL query "select c from g where c1 = ? and c2 = '$1'".&nbsp; Note that ? in this example will be replaced with the actual value bound to parameter 1.</p>

<h3><a name="JDBCTranslator-DirectQueryProcedure"></a>Direct Query Procedure</h3>

<div class='panelMacro'><table class='warningMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/forbidden.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>This feature is turned off by default because of the security risk this exposes to execute any command against the source. To enable this feature, <a href="/author/display/TEIID/Translators#Translators-OverrideExecutionProperties">override the execution property</a> called <em>SupportsDirectQueryProcedure</em> to true.</td></tr></table></div>

<div class='panelMacro'><table class='infoMacro'><colgroup><col width='24'><col></colgroup><tr><td valign='top'><img src="/author/images/icons/emoticons/information.gif" width="16" height="16" align="absmiddle" alt="" border="0"></td><td>By default the name of the procedure that executes the queries directly is <b>native</b>. <a href="/author/display/TEIID/Translators#Translators-OverrideExecutionProperties">Override the execution property</a> <em>DirectQueryProcedureName</em> to change it to another name.</td></tr></table></div>

<p>The JDBC translator provides a procedure to execute any ad-hoc SQL query directly against the source without Teiid parsing or resolving. Since the metadata of this procedure's results are not known to Teiid, they are returned as an object array. <a href="/author/display/TEIID/ARRAYTABLE" title="ARRAYTABLE">ARRAYTABLE</a> can be used construct tabular output for consumption by client applications.</p>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Select Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call jdbc_source.native('select * from g1')) w,
 ARRAYTABLE(w.tuple COLUMNS "e1" integer , "e2" string) AS x
</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Insert Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call jdbc_source.native('insert into g1 (e1,e2) values (?, ?)', 112, 'foo')) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Update Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call jdbc_source.native('update g1 set e2=? where e1 = ?','blah', 112)) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>

<div class="code panel" style="border-width: 1px;"><div class="codeHeader panelHeader" style="border-bottom-width: 1px;"><b>Delete Example</b></div><div class="codeContent panelContent">
<pre class="theme: Confluence; brush: sql; gutter: false" style="font-size:12px; font-family: ConfluenceInstalledFont,monospace;">
SELECT x.* FROM (call jdbc_source.native('delete from g1 where e1 = ?', 112)) w,
 ARRAYTABLE(w.tuple COLUMNS "update_count" integer) AS x
</pre>
</div></div>

<h3><a name="JDBCTranslator-JCAResourceAdapter"></a>JCA Resource Adapter</h3>

<p>The resource adapter for this translator provided through data source in JBoss AS, Refer to Admin Guide for "JDBC Data Sources" configuration section.</p>
    </div>
        <div id="commentsSection" class="wiki-content pageSection">
        <div style="float: right;" class="grey">
                        <a href="https://docs.jboss.org/author/users/removespacenotification.action?spaceKey=TEIID">Stop watching space</a>
            <span style="padding: 0px 5px;">|</span>
                <a href="https://docs.jboss.org/author/users/editmyemailsettings.action">Change email notification preferences</a>
</div>
        <a href="https://docs.jboss.org/author/display/TEIID/JDBC+Translator">View Online</a>
        |
        <a href="https://docs.jboss.org/author/pages/diffpagesbyversion.action?pageId=55477034&revisedVersion=59&originalVersion=58">View Changes</a>
                |
        <a href="https://docs.jboss.org/author/display/TEIID/JDBC+Translator?showComments=true&amp;showCommentArea=true#addcomment">Add Comment</a>
            </div>
</div>
</div>
</div>
</div>
</body>
</html>