teiid SVN: r2290 - branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-06-23 16:58:24 -0400 (Wed, 23 Jun 2010)
New Revision: 2290
Modified:
branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml
branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml
Log:
TEIID-973: Making quick start to only use the Dynamic VDB example; thus removing the dependency on the Designer screen shots or video.
Modified: branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml
===================================================================
--- branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml 2010-06-23 20:41:14 UTC (rev 2289)
+++ branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml 2010-06-23 20:58:24 UTC (rev 2290)
@@ -2,65 +2,86 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="step-3">
<title>Building a VDB</title>
- <para>A VDB can be built with either the <link linkend="designer">Designer</link> tool or through a simple XML file called a dynamic VDB. See the dyanmicvdb-portolio for an example dynamic VDB. You can skip the next section if you choose to use a dynamic VDB.</para>
- <sect1 id="designer">
- <title>Using Teiid Designer to build a VDB</title>
- <sect2>
- <title>Download Teiid Designer</title>
+ <para>A VDB can be built with either the <ulink url="http://www.jboss.org/teiiddesigner.html">Designer</ulink> tool or through a
+ simple XML file called a dynamic VDB. See the "dyanmicvdb-portolio" for an example dynamic VDB.
+ for this example purpose we will use the a dynamic VDB. If you would like to use the
+ Designer to build your VDB, check out the Designer examples. If you need to build any view layers using your source,
+ you must use Designer based approach to building the VDB. A sample Designer based VDB is
+ available in the "teiid-examples/portfolio/PortfolioModel" directory.</para>
+
+ <sect1 id="dynamic_vdb">
+ <title>Building Dynamic VDB</title>
+ <para>This XML file is defines a set of sources that need to treated as single source by the client application.
+ Dynamic VDB does not yet allow for the creation of view layers. Below XML file defines "dynamicvdb-portfolio" example
+ vdb.</para>
+ <para>portfolio-vdb.xml (copy available in "teiid-examples/dynamicvdb-portfolio" directory)</para>
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<vdb name="DynamicPortfolio" version="1">
+
+ <description>A Dynamic VDB</description>
- <note>
- <para>
- If you would like to skip building your own VDB, you can safely go to next page and continue with the
- exercise as there is a pre-built VDB available for your convenience in the
- examples/portfolio/PortfolioModel directory of the download.
- </para>
- </note>
-
- <para>
- The Teiid Designer project provides a Eclipse based designer tool for this purpose of building a VDB. You can
- download Teiid Designer
- <ulink url="http://www.jboss.org/teiiddesigner/downloads.html">here</ulink>
- Once downloaded, please follow the installation instructions. Start the Teiid Designer and return here to continue
- building the VDB.
- </para>
- </sect2>
-
- <para>Once you start the Designer, there are several steps you must perform to create a VDB. These steps are
- summarized in the following table.</para>
+ <!--
+ Setting to use connector supplied metadata. Can be "true" or "cached".
+ "true" will obtain metadata once for every launch of Teiid.
+ "cached" will save a file containing the metadata into
+ the deploy/<vdb name>/<vdb version/META-INF directory
+ -->
+ <property name="UseConnectorMetadata" value="cached" />
+
+
+ <!--
+ Each model represents a access to one or more sources.
+ The name of the model will be used as a top level schema name
+ for all of the metadata imported from the connector.
+
+ NOTE: Multiple model, with different import settings, can be bound to
+ the same connector binding and will be treated as the same source at
+ runtime.
+ -->
+ <model name="MarketData">
+ <!--
+ Each source represents a translator and data source. There are
+ pre-defined translators, or you can create one. ConnectionFactories
+ or DataSources in JBoss AS they are typically defined using "xxx-ds.xml" files.
+ -->
+ <source name="text-connector" translator-name="file" connection-jndi-name="java:marketdata-file"/>
+ </model>
+
+ <model name="Accounts">
+ <!--
+ JDBC Import settings
+
+ importer.useFullSchemaName directs the importer to drop the source
+ schema from the Teiid object name, so that the Teiid fully qualified name
+ will be in the form of <model name>.<table name>
+ -->
+ <property name="importer.useFullSchemaName" value="false"/>
+
+ <!--
+ This connector is defined in the "derby-connector-ds.xml"
+ -->
+ <source name="derby-connector" translator-name="derby" connection-jndi-name="java:PortfolioDS"/>
+ </model>
+
+</vdb>
+ ]]></programlisting>
+
+ <para>The XML file is explained below.</para>
<orderedlist>
- <listitem>
- <para>Switch to the Designer Perspective, by opening the "Window->Open Perspective.."</para>
- </listitem>
- <listitem>
- <para>Create new "Model Project", using "File->New->ModelProject"</para>
- </listitem>
- <listitem>
- <para>Import the Derby database's "account" schema into a source model.</para>
- </listitem>
- <listitem>
- <para>Manually create the view model for the "Text File". Create a Table called "Price" with
- "stock" and "price" as column names. In the transformation window add the following SQL</para>
- </listitem>
- <listitem>
- <para>Create a view model called "AccountView"</para>
- </listitem>
- <listitem>
- <para>In the "AccountView" model, create a virtual table (called as Base Table in the menu), and build
- the transformation query combining the "Accounts" tables with "Price" table</para>
- </listitem>
- <listitem>
- <para>In the "AccountView" model, create a virtual procedure called "buyStock", to learn about procedure
- language.</para>
- </listitem>
- <listitem>
- <para>Create a VDB based on the models created</para>
- </listitem>
- <listitem>
- <para>Test the created VDB with some ad-hoc queries inside Designer.</para>
- </listitem>
- <listitem>
- <para>Export or copy the VDB for use in your application.</para>
- </listitem>
+ <listitem><para>The above XML file defines a "vdb" with name "DynamicPortfolio" with version "1"</para></listitem>
+ <listitem><para>A "model" XML element represents a schema that being integrated. This sample
+ defines two sources, "MarketData" that represents the schema for the text file that has the
+ stock price information and "Accounts" that represents the "portfolio" schema in the Derby database.
+ </para></listitem>
+ <listitem><para>The "source" element inside the "model" element defines name of the source (can be any name), and
+ name of the translator (defines the type of the source like oracle, db2, mysql, h2, file, ws etc..) and the
+ "connection-jndi-name" defines the source's JNDI name in the JBoss AS container.</para></listitem>
+ <listitem><para>Also note that inside the "model" elements, some "property" elements are used to define how
+ metadata can be imported from source. For more information check out the Reference Guide's Dynamic VDB section.</para></listitem>
+ <listitem><para>Note that you need to also create the necessary deployment
+ files for the data sources (Connection Factories) too.</para></listitem>
</orderedlist>
- </sect1>
+
+ </sect1>
</chapter>
\ No newline at end of file
Modified: branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml
===================================================================
--- branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml 2010-06-23 20:41:14 UTC (rev 2289)
+++ branches/7.0.x/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml 2010-06-23 20:58:24 UTC (rev 2290)
@@ -33,7 +33,7 @@
<emphasis>jdbc:teiid:<VDB-Name>@mm(s)://<host name>:<port>;autoCommitTxn=DETECT</emphasis>
</para>
<para>
- You can use any of these <ulink url="https://www.jboss.org/community/docs/DOC-13157"> optional connection properties </ulink>
+ Check out Client Developer's guide for all the optional connection properties
in your URL. Here is sample code showing how to make JDBC connection.
</para>
<programlisting><![CDATA[public void execute() throws SQLException {
@@ -76,8 +76,7 @@
Connection connection = ds.getConnection();
...]]></programlisting>
<para>TeiidDataSource source also provides an option to set optional parameters using the "set" methods on the
- data source look. For all the allowable properties at the
- <ulink url="https://www.jboss.org/community/docs/DOC-13158">data source properties</ulink>.</para>
+ data source look. For all the allowable data source properties check out Client Developer's Guide.</para>
</sect1>
<sect1>
<title>Testing Your Teiid Deployment</title>
@@ -95,7 +94,7 @@
<para>If your application is Web based, you can create data source for your VDB using the above and treat it as any other JDBC source using
<code>org.teiid.jdbc.TeiidDataSource</code> and assigning it a JNDI name.
- Refer to <ulink url="https://community.jboss.org/docs/DOC-13888">deployment to application server</ulink> for more information.
+ Refer to Client Developer's Guide deployment for more information on creating a DataSource.
</para>
<note><para>"embedded" mode is only available in versions of Teiid up to 6.2</para></note>
</sect1>
14 years, 6 months
teiid SVN: r2289 - /.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-06-23 16:41:14 -0400 (Wed, 23 Jun 2010)
New Revision: 2289
Removed:
connector-ws/
Log:
misc: Added at a worng location by eclipse; deleting it
14 years, 6 months
teiid SVN: r2288 - trunk/documentation/quick-start-example/src/main/docbook/en-US/content.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-06-23 16:17:49 -0400 (Wed, 23 Jun 2010)
New Revision: 2288
Modified:
trunk/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml
trunk/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml
Log:
TEIID-973: converted the quick start to use the Dynamic VDB.
Modified: trunk/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml
===================================================================
--- trunk/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml 2010-06-23 18:47:52 UTC (rev 2287)
+++ trunk/documentation/quick-start-example/src/main/docbook/en-US/content/buildvdb.xml 2010-06-23 20:17:49 UTC (rev 2288)
@@ -2,65 +2,86 @@
<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<chapter id="step-3">
<title>Building a VDB</title>
- <para>A VDB can be built with either the <link linkend="designer">Designer</link> tool or through a simple XML file called a dynamic VDB. See the dyanmicvdb-portolio for an example dynamic VDB. You can skip the next section if you choose to use a dynamic VDB.</para>
- <sect1 id="designer">
- <title>Using Teiid Designer to build a VDB</title>
- <sect2>
- <title>Download Teiid Designer</title>
+ <para>A VDB can be built with either the <ulink url="http://www.jboss.org/teiiddesigner.html">Designer</ulink> tool or through a
+ simple XML file called a dynamic VDB. See the "dyanmicvdb-portolio" for an example dynamic VDB.
+ for this example purpose we will use the a dynamic VDB. If you would like to use the
+ Designer to build your VDB, check out the Designer examples. If you need to build any view layers using your source,
+ you must use Designer based approach to building the VDB. A sample Designer based VDB is
+ available in the "teiid-examples/portfolio/PortfolioModel" directory.</para>
+
+ <sect1 id="dynamic_vdb">
+ <title>Building Dynamic VDB</title>
+ <para>This XML file is defines a set of sources that need to treated as single source by the client application.
+ Dynamic VDB does not yet allow for the creation of view layers. Below XML file defines "dynamicvdb-portfolio" example
+ vdb.</para>
+ <para>portfolio-vdb.xml (copy available in "teiid-examples/dynamicvdb-portfolio" directory)</para>
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<vdb name="DynamicPortfolio" version="1">
+
+ <description>A Dynamic VDB</description>
- <note>
- <para>
- If you would like to skip building your own VDB, you can safely go to next page and continue with the
- exercise as there is a pre-built VDB available for your convenience in the
- examples/portfolio/PortfolioModel directory of the download.
- </para>
- </note>
-
- <para>
- The Teiid Designer project provides a Eclipse based designer tool for this purpose of building a VDB. You can
- download Teiid Designer
- <ulink url="http://www.jboss.org/teiiddesigner/downloads.html">here</ulink>
- Once downloaded, please follow the installation instructions. Start the Teiid Designer and return here to continue
- building the VDB.
- </para>
- </sect2>
-
- <para>Once you start the Designer, there are several steps you must perform to create a VDB. These steps are
- summarized in the following table.</para>
+ <!--
+ Setting to use connector supplied metadata. Can be "true" or "cached".
+ "true" will obtain metadata once for every launch of Teiid.
+ "cached" will save a file containing the metadata into
+ the deploy/<vdb name>/<vdb version/META-INF directory
+ -->
+ <property name="UseConnectorMetadata" value="cached" />
+
+
+ <!--
+ Each model represents a access to one or more sources.
+ The name of the model will be used as a top level schema name
+ for all of the metadata imported from the connector.
+
+ NOTE: Multiple model, with different import settings, can be bound to
+ the same connector binding and will be treated as the same source at
+ runtime.
+ -->
+ <model name="MarketData">
+ <!--
+ Each source represents a translator and data source. There are
+ pre-defined translators, or you can create one. ConnectionFactories
+ or DataSources in JBoss AS they are typically defined using "xxx-ds.xml" files.
+ -->
+ <source name="text-connector" translator-name="file" connection-jndi-name="java:marketdata-file"/>
+ </model>
+
+ <model name="Accounts">
+ <!--
+ JDBC Import settings
+
+ importer.useFullSchemaName directs the importer to drop the source
+ schema from the Teiid object name, so that the Teiid fully qualified name
+ will be in the form of <model name>.<table name>
+ -->
+ <property name="importer.useFullSchemaName" value="false"/>
+
+ <!--
+ This connector is defined in the "derby-connector-ds.xml"
+ -->
+ <source name="derby-connector" translator-name="derby" connection-jndi-name="java:PortfolioDS"/>
+ </model>
+
+</vdb>
+ ]]></programlisting>
+
+ <para>The XML file is explained below.</para>
<orderedlist>
- <listitem>
- <para>Switch to the Designer Perspective, by opening the "Window->Open Perspective.."</para>
- </listitem>
- <listitem>
- <para>Create new "Model Project", using "File->New->ModelProject"</para>
- </listitem>
- <listitem>
- <para>Import the Derby database's "account" schema into a source model.</para>
- </listitem>
- <listitem>
- <para>Manually create the view model for the "Text File". Create a Table called "Price" with
- "stock" and "price" as column names. In the transformation window add the following SQL</para>
- </listitem>
- <listitem>
- <para>Create a view model called "AccountView"</para>
- </listitem>
- <listitem>
- <para>In the "AccountView" model, create a virtual table (called as Base Table in the menu), and build
- the transformation query combining the "Accounts" tables with "Price" table</para>
- </listitem>
- <listitem>
- <para>In the "AccountView" model, create a virtual procedure called "buyStock", to learn about procedure
- language.</para>
- </listitem>
- <listitem>
- <para>Create a VDB based on the models created</para>
- </listitem>
- <listitem>
- <para>Test the created VDB with some ad-hoc queries inside Designer.</para>
- </listitem>
- <listitem>
- <para>Export or copy the VDB for use in your application.</para>
- </listitem>
+ <listitem><para>The above XML file defines a "vdb" with name "DynamicPortfolio" with version "1"</para></listitem>
+ <listitem><para>A "model" XML element represents a schema that being integrated. This sample
+ defines two sources, "MarketData" that represents the schema for the text file that has the
+ stock price information and "Accounts" that represents the "portfolio" schema in the Derby database.
+ </para></listitem>
+ <listitem><para>The "source" element inside the "model" element defines name of the source (can be any name), and
+ name of the translator (defines the type of the source like oracle, db2, mysql, h2, file, ws etc..) and the
+ "connection-jndi-name" defines the source's JNDI name in the JBoss AS container.</para></listitem>
+ <listitem><para>Also note that inside the "model" elements, some "property" elements are used to define how
+ metadata can be imported from source. For more information check out the Reference Guide's Dynamic VDB section.</para></listitem>
+ <listitem><para>Note that you need to also create the necessary deployment
+ files for the data sources (Connection Factories) too.</para></listitem>
</orderedlist>
- </sect1>
+
+ </sect1>
</chapter>
\ No newline at end of file
Modified: trunk/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml
===================================================================
--- trunk/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml 2010-06-23 18:47:52 UTC (rev 2287)
+++ trunk/documentation/quick-start-example/src/main/docbook/en-US/content/connect-vdb.xml 2010-06-23 20:17:49 UTC (rev 2288)
@@ -33,7 +33,7 @@
<emphasis>jdbc:teiid:<VDB-Name>@mm(s)://<host name>:<port>;autoCommitTxn=DETECT</emphasis>
</para>
<para>
- You can use any of these <ulink url="https://www.jboss.org/community/docs/DOC-13157"> optional connection properties </ulink>
+ Check out Client Developer's guide for all the optional connection properties
in your URL. Here is sample code showing how to make JDBC connection.
</para>
<programlisting><![CDATA[public void execute() throws SQLException {
@@ -76,8 +76,7 @@
Connection connection = ds.getConnection();
...]]></programlisting>
<para>TeiidDataSource source also provides an option to set optional parameters using the "set" methods on the
- data source look. For all the allowable properties at the
- <ulink url="https://www.jboss.org/community/docs/DOC-13158">data source properties</ulink>.</para>
+ data source look. For all the allowable data source properties check out Client Developer's Guide.</para>
</sect1>
<sect1>
<title>Testing Your Teiid Deployment</title>
@@ -95,7 +94,7 @@
<para>If your application is Web based, you can create data source for your VDB using the above and treat it as any other JDBC source using
<code>org.teiid.jdbc.TeiidDataSource</code> and assigning it a JNDI name.
- Refer to <ulink url="https://community.jboss.org/docs/DOC-13888">deployment to application server</ulink> for more information.
+ Refer to Client Developer's Guide deployment for more information on creating a DataSource.
</para>
<note><para>"embedded" mode is only available in versions of Teiid up to 6.2</para></note>
</sect1>
14 years, 6 months
teiid SVN: r2287 - in trunk: build/assembly/jboss-container and 4 other directories.
by teiid-commits@lists.jboss.org
Author: rareddy
Date: 2010-06-23 14:47:52 -0400 (Wed, 23 Jun 2010)
New Revision: 2287
Added:
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-selfcerts.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-unsupported-jdbc.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/entitlements.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-transactions.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/main.xml
Removed:
trunk/documentation/assembly/
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/other_commands.xml
Modified:
trunk/build/assembly/docs.xml
trunk/build/assembly/jboss-container/dist.xml
trunk/documentation/client-developers-guide/
trunk/documentation/client-developers-guide/pom.xml
trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
trunk/documentation/pom.xml
Log:
TEIID-1037: Adding the Client Developers Guide. Merged information from WIKI, old MM document and new content.
Modified: trunk/build/assembly/docs.xml
===================================================================
--- trunk/build/assembly/docs.xml 2010-06-23 17:10:08 UTC (rev 2286)
+++ trunk/build/assembly/docs.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -18,6 +18,7 @@
<include>org.jboss.teiid.documentation:reference</include>
<include>org.jboss.teiid.documentation:developer-guide</include>
<include>org.jboss.teiid.documentation:quick-start-example</include>
+ <include>org.jboss.teiid.documentation:client-developers-guide</include>
</includes>
<sources>
Modified: trunk/build/assembly/jboss-container/dist.xml
===================================================================
--- trunk/build/assembly/jboss-container/dist.xml 2010-06-23 17:10:08 UTC (rev 2286)
+++ trunk/build/assembly/jboss-container/dist.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -64,6 +64,11 @@
<source>target/distribution/teiid-${version}-docs/developer-guide/en-US/pdf/developer_guide.pdf</source>
<outputDirectory>teiid-docs</outputDirectory>
</file>
+ <file>
+ <source>target/distribution/teiid-${version}-docs/client-developers-guide/en-US/pdf/client_developers_guide.pdf</source>
+ <outputDirectory>teiid-docs</outputDirectory>
+ </file>
+
</files>
Property changes on: trunk/documentation/client-developers-guide
___________________________________________________________________
Name: svn:ignore
+ target
.project
.settings
.classpath
Modified: trunk/documentation/client-developers-guide/pom.xml
===================================================================
--- trunk/documentation/client-developers-guide/pom.xml 2010-06-23 17:10:08 UTC (rev 2286)
+++ trunk/documentation/client-developers-guide/pom.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -37,7 +37,7 @@
</dependency>
</dependencies>
<configuration>
- <sourceDocumentName>DataCaching.xml</sourceDocumentName>
+ <sourceDocumentName>main.xml</sourceDocumentName>
<imageResource>
<directory>${basedir}/src/main/docbook/en-US</directory>
<excludes>
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-selfcerts.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-selfcerts.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-selfcerts.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<appendix id="appendix-selfcerts">
+ <title>Generating Self Signed Certificate with Keytool</title>
+ <para>To generate a self-signed certificate, you need a program called “keytool”, which is
+ supplied with any version of the Java SDK. The instructions below walk through the creation
+ of both the key store and the trust store files for a 1-way SSL configuration with
+ the security keys.</para>
+
+ <sect1>
+ <title>Creating private/public key pair:</title>
+ <programlisting><![CDATA[
+keytool -genkey -alias teiid -keyalg RSA -validity 365 –keystore
+server.keystore –storetype JKS
+
+ Enter keystore password: <enter password>
+ What is your first and last name?
+ [Unknown]: <user’s name>
+ What is the name of your organizational unit?
+ [Unknown]: <department name>
+ What is the name of your organization?
+ [Unknown]: <company name>
+ What is the name of your City or Locality?
+ [Unknown]: <city name>
+ What is the name of your State or Province?
+ [Unknown]: <state name>
+ What is the two-letter country code for this unit?
+ [Unknown]: <country name>
+
+ Is CN=<user’s name>, OU=<department name>, O="<company name>",
+ L=<city name>, ST=<state name>, C=<country name> correct?
+ [no]: yes
+ Enter key password for <server>
+ (Return if same as keystore password)
+ ]]></programlisting>
+ <para>The "server.keystore" can be used as keystore based upon the newly created private key.</para>
+ </sect1>
+
+ <sect1>
+ <title>Extracting the public key</title>
+ <para>From the "server.keystore" created above we can extract a public key for creating a trust store</para>
+ <programlisting><![CDATA[
+keytool -export -alias teiid –keystore server.keystore -rfc -file public.cert
+ Enter keystore password: <enter passsword>
+ ]]></programlisting>
+ <para>This creates the "public.cert" file that contains the public key based on the
+ private key in the "server.keystore"</para>
+ </sect1>
+
+ <sect1>
+ <title>Creating the Truststore</title>
+
+ <programlisting><![CDATA[
+keytool -import -alias teiid -file public.cert –storetype JKS -keystore server.truststore
+Enter keystore password: <enter password>
+Owner: CN=<user's name>, OU=<dept name>, O=<company name>, L=<city>, ST=<state>, C=<country>
+Issuer: CN=<user's name>, OU=<dept name>, O=<company name>, L=<city>, ST=<state>, C=<country>
+Serial number: 416d8636
+Valid from: Fri Jul 31 14:47:02 CDT 2009 until: Sat Jul 31 14:47:02 CDT 2010
+Certificate fingerprints:
+ MD5: 22:4C:A4:9D:2E:C8:CA:E8:81:5D:81:35:A1:84:78:2F
+ SHA1: 05:FE:43:CC:EA:39:DC:1C:1E:40:26:45:B7:12:1C:B9:22:1E:64:63
+Trust this certificate? [no]: yes
+ ]]></programlisting>
+ <para>Now this has created "server.truststore". There are many other ways to create self signed certificates,
+ the above procedure is just one way. If you would like create them
+ using "openssl", see <ulink url="http://www.akadia.com/services/ssh_test_certificate.html">this tutorial</ulink>.</para>
+ </sect1>
+
+</appendix>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-selfcerts.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-unsupported-jdbc.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-unsupported-jdbc.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-unsupported-jdbc.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,335 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<appendix id="unsupported_jdbc">
+ <title>Unsupported JDBC Methods</title>
+ <para>Based upon the JDBC in JDK 1.6, this appendix details only those JDBC methods
+ that Teiid does not support. Unless specified below, Teiid supports all other JDBC Methods.</para>
+ <para>Those methods listed without comments throw a SQLException stating that it is not supported.</para>
+
+ <para>Where specified, some listed methods do not throw an exception, but possibly exhibit unexpected behavior.
+ If no arguments are specified, then all related (overridden) methods are not supported. If an argument is listed
+ then only those forms of the method specified are not supported.</para>
+
+ <sect1>
+ <title>Unsupported Classes and Methods in "java.sql"</title>
+ <table frame='all'>
+ <title>Connection Properties</title>
+ <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*" />
+ <colspec colname='c2' colwidth="2*" />
+ <thead>
+ <row>
+ <entry>Class name</entry>
+ <entry>Methods</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <code>Array</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Blob</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+getBinaryStream(long, long) - throws SQLFeatureNotSupportedException
+setBinaryStream(long) - - throws SQLFeatureNotSupportedException
+setBytes - - throws SQLFeatureNotSupportedException
+truncate(long) - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>CallableStatement</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+getArray - throws SQLFeatureNotSupportedException
+getBigDecimal(String parameterName)- throws SQLFeatureNotSupportedException
+getBlob(String parameterName)- throws SQLFeatureNotSupportedException
+getBoolean(String parameterName)- throws SQLFeatureNotSupportedException
+getByte(String parameterName)- throws SQLFeatureNotSupportedException
+getBytes(String parameterName)- throws SQLFeatureNotSupportedException
+getCharacterStream(String parameterName)- throws SQLFeatureNotSupportedException
+getClob(String parameterName)- throws SQLFeatureNotSupportedException
+getDate(String parameterName, *)- throws SQLFeatureNotSupportedException
+getDouble(String parameterName)- throws SQLFeatureNotSupportedException
+getFloat(String parameterName)- throws SQLFeatureNotSupportedException
+getInt(String parameterName)- throws SQLFeatureNotSupportedException
+getLong(String parameterName)- throws SQLFeatureNotSupportedException
+getNCharacterStream - throws SQLFeatureNotSupportedException
+getNClob - throws SQLFeatureNotSupportedException
+getNString - throws SQLFeatureNotSupportedException
+getObject(int parameterIndex, Map<String, Class<?>> map) - throws SQLFeatureNotSupportedException
+getObject(String parameterName) - throws SQLFeatureNotSupportedException
+getRef - throws SQLFeatureNotSupportedException
+getRowId - throws SQLFeatureNotSupportedException
+getShort(String parameterName) - throws SQLFeatureNotSupportedException
+getSQLXML(String parameterName) - throws SQLFeatureNotSupportedException
+getString(String parameterName) - throws SQLFeatureNotSupportedException
+getTime(String parameterName, *) - throws SQLFeatureNotSupportedException
+getTimestamp(String parameterName, *) - throws SQLFeatureNotSupportedException
+getURL(String parameterName) - throws SQLFeatureNotSupportedException
+registerOutParameter - ignores
+registerOutParameter(String parameterName, *) - throws SQLFeatureNotSupportedException
+setAsciiStream - throws SQLFeatureNotSupportedException
+setBigDecimal(String parameterName, BigDecimal x)- throws SQLFeatureNotSupportedException
+setBinaryStream(String parameterName, *) - throws SQLFeatureNotSupportedException
+setBlob(String parameterName, *)- throws SQLFeatureNotSupportedException
+setBoolean(String parameterName, boolean x) - throws SQLFeatureNotSupportedException
+setByte(String parameterName, byte x) - throws SQLFeatureNotSupportedException
+setBytes(String parameterName, byte[] x) - throws SQLFeatureNotSupportedException
+setCharacterStream - throws SQLFeatureNotSupportedException
+setClob(String parameterName, *) - throws SQLFeatureNotSupportedException
+setDate(String parameterName, *) - throws SQLFeatureNotSupportedException
+setDouble(String parameterName, double x) - throws SQLFeatureNotSupportedException
+setFloat(String parameterName, float x) - throws SQLFeatureNotSupportedException
+setLong(String parameterName, long x) - throws SQLFeatureNotSupportedException
+setNCharacterStream - throws SQLFeatureNotSupportedException
+setNClob - throws SQLFeatureNotSupportedException
+setNString - throws SQLFeatureNotSupportedException
+setNull - throws SQLFeatureNotSupportedException
+setObject(String parameterName, *) - throws SQLFeatureNotSupportedException
+setRowId(String parameterName, RowId x) - throws SQLFeatureNotSupportedException
+setSQLXML(String parameterName, SQLXML xmlObject) - throws SQLFeatureNotSupportedException
+setShort(String parameterName, short x) - throws SQLFeatureNotSupportedException
+setString(String parameterName, String x) - throws SQLFeatureNotSupportedException
+setTime(String parameterName, *) - throws SQLFeatureNotSupportedException
+setTimestamp(String parameterName, *) - throws SQLFeatureNotSupportedException
+setURL(String parameterName, URL val) - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Clob</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+getCharacterStream(long arg0, long arg1) - throws SQLFeatureNotSupportedException
+setAsciiStream(long arg0) - throws SQLFeatureNotSupportedException
+setCharacterStream(long arg0) - throws SQLFeatureNotSupportedException
+setString - throws SQLFeatureNotSupportedException
+truncate - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Connection</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+createArrayOf - throws SQLFeatureNotSupportedException
+createBlob - throws SQLFeatureNotSupportedException
+createClob - throws SQLFeatureNotSupportedException
+createNClob - throws SQLFeatureNotSupportedException
+createSQLXML - throws SQLFeatureNotSupportedException
+createStatement(int resultSetType,int resultSetConcurrency, int resultSetHoldability) - throws SQLFeatureNotSupportedException
+createStruct(String typeName, Object[] attributes) - throws SQLFeatureNotSupportedException
+getClientInfo - throws SQLFeatureNotSupportedException
+prepareCall(String sql, int resultSetType,int resultSetConcurrency, int resultSetHoldability) - throws SQLFeatureNotSupportedException
+prepareStatement(String sql, int autoGeneratedKeys) - throws SQLFeatureNotSupportedException
+prepareStatement(String sql, int[] columnIndexes) - throws SQLFeatureNotSupportedException
+prepareStatement(String sql, String[] columnNames) - throws SQLFeatureNotSupportedException
+releaseSavepoint - throws SQLFeatureNotSupportedException
+rollback(Savepoint savepoint) - throws SQLFeatureNotSupportedException
+setHoldability - throws SQLFeatureNotSupportedException
+setSavepoint - throws SQLFeatureNotSupportedException
+setTypeMap - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>DatabaseMetaData</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+getAttributes - throws SQLFeatureNotSupportedException
+getClientInfoProperties - throws SQLFeatureNotSupportedException
+getFunctionColumns - throws SQLFeatureNotSupportedException
+getFunctions - throws SQLFeatureNotSupportedException
+getRowIdLifetime - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>NClob</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>PreparedStatement</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+execute(String sql) - throws SQLException
+executeQuery(String sql) - throws SQLException
+executeUpdate(String sql) - throws SQLException
+setArray - throws SQLFeatureNotSupportedException
+setNCharacterStream - throws SQLFeatureNotSupportedException
+setNClob - throws SQLFeatureNotSupportedException
+setRef - throws SQLFeatureNotSupportedException
+setRowId - throws SQLFeatureNotSupportedException
+setUnicodeStream - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Ref</code>
+ </entry>
+ <entry>
+ <code>Not Implemented</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>ResultSet</code>
+ </entry>
+ <entry>
+ <programlisting><![CDATA[
+deleteRow - throws SQLFeatureNotSupportedException
+getArray - throws SQLFeatureNotSupportedException
+getAsciiStream - throws SQLFeatureNotSupportedException
+getHoldability - throws SQLFeatureNotSupportedException
+getNCharacterStream - throws SQLFeatureNotSupportedException
+getNClob - throws SQLFeatureNotSupportedException
+getNString - throws SQLFeatureNotSupportedException
+getObject(*, Map<String, Class<?>> map) - throws SQLFeatureNotSupportedException
+getRef - throws SQLFeatureNotSupportedException
+getRowId - throws SQLFeatureNotSupportedException
+getUnicodeStream - throws SQLFeatureNotSupportedException
+getURL - throws SQLFeatureNotSupportedException
+insertRow - throws SQLFeatureNotSupportedException
+moveToInsertRow - throws SQLFeatureNotSupportedException
+refreshRow - throws SQLFeatureNotSupportedException
+rowDeleted - throws SQLFeatureNotSupportedException
+rowInserted - throws SQLFeatureNotSupportedException
+rowUpdated - throws SQLFeatureNotSupportedException
+setFetchDirection - throws SQLFeatureNotSupportedException
+update* - throws SQLFeatureNotSupportedException
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>RowId</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Savepoint</code>
+ </entry>
+ <entry>
+ <code>not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>SQLData</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>SQLInput</code>
+ </entry>
+ <entry>
+ <code>not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>SQLOutput</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Statement</code>
+ </entry>
+ <entry>
+ <programlisting ><![CDATA[
+execute(String, int)
+execute(String, int[])
+execute(String, String[])
+executeUpdate(String, int)
+executeUpdate(String, int[])
+executeUpdate(String, String[])
+getGeneratedKeys()
+getResultSetHoldability()
+setCursorName(String)
+ ]]></programlisting>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>Struct</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect1>
+
+ <sect1>
+ <title>Unsupported Classes and Methods in "javax.sql"</title>
+ <table frame='all'>
+ <title>Connection Properties</title>
+ <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*" />
+ <colspec colname='c2' colwidth="2*" />
+ <thead>
+ <row>
+ <entry>Class name</entry>
+ <entry>Methods</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <code>RowSet*</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>StatementEventListener</code>
+ </entry>
+ <entry>
+ <code>Not Supported</code>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ </sect1>
+</appendix>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/appendix-unsupported-jdbc.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/entitlements.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/entitlements.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/entitlements.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,127 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="entitlements">
+ <title>Entitlements/Data Roles</title>
+ <para>Entitlements, also called as Data Roles, are a set of rules and permissions that are defined
+ per VDB that dictate data access (create, read, update, delete) permissions for the schema defined
+ by the VDB. The use of entitlements are controlled system wide with the property in
+ <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code> file
+ in bean configuration section of <code>RuntimeEngineDeployer</code> with property <code>useEntitlements</code>.</para>
+
+ <para>Once the entitlements are enabled, the access permissions defined in each VDB will then be enforced by the Teiid Server.
+ To process an <code>INSERT</code> statement, the user account requires the following access rights:</para>
+ <orderedlist>
+ <listitem> <para><code>CREATE</code> - on the Table being inserted into.</para></listitem>
+ <listitem> <para><code>CREATE</code> - on every column being inserted on that Table.</para></listitem>
+ </orderedlist>
+
+ <para>To process an <code>UPDATE</code> statement, the user account requires the following access rights:</para>
+ <orderedlist>
+ <listitem> <para><code>UPDATE</code> - on the Table being updated.</para></listitem>
+ <listitem> <para><code>UPDATE</code> - on every column being updated on that Table.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced in the criteria.</para></listitem>
+ </orderedlist>
+
+ <para>To process a <code>DELETE</code> statement, the user account requires the following access rights:</para>
+ <orderedlist>
+ <listitem> <para><code>DELETE</code> - on the Table being deleted.</para></listitem>
+ <listitem> <para><code>READ</code> - on every column referenced in the criteria.</para></listitem>
+ </orderedlist>
+
+ <para>The data roles are defined inside the <code>META-INF/vdb.xml</code> file, f you used Designer to build your VDB.
+ They defined inside the <code>-vdb.xml</code> file defined if you are using the Dynamic VDBs. The below example will show
+ a sample "vdb.xml" file with few simple data rules.</para>
+
+ <para>For example, if a VDB schema defined a table below in its model files named "modelName"</para>
+
+ <programlisting><![CDATA[
+ modelName.TableA (
+ column1 VARCHAR,
+ column2 INT
+ )
+ ]]></programlisting>
+
+ <para>and has three (3) users "UserA", "UserB", "UserC" with following permissions</para>
+ <orderedlist>
+ <listitem><para>UserA has privileges to read, write access to TableA, but can not delete.</para></listitem>
+ <listitem><para>UserB has no privileges that allow access to TableA</para></listitem>
+ <listitem><para>UserC has privileges that only allow read access to TableA.column1</para></listitem>
+ </orderedlist>
+
+ <para>Then the resulting "vdb.xml" file will look like below.</para>
+
+ <programlisting><![CDATA[
+<?xml version="1.0" encoding="UTF-8"?>
+<vdb name="sample" version="1">
+
+ <model name="modelName">
+ <source name="source-name" translator-name="oracle" connection-jndi-name="java:myDS" />
+ </model>
+
+ <data-policy name="policy-1">
+ <description>Allow all, except Delete</description>
+
+ <permission>
+ <resource-name>modelName.TableA</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.colum1</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.column2</resource-name>
+ <allow-create />
+ <allow-read />
+ <allow-update />
+ </permission>
+
+ <mapped-role-name>role1</mapped-role-name>
+
+ </data-policy>
+
+ <data-policy name="policy-2">
+ <description>Allow read only</description>
+
+ <permission>
+ <resource-name>modelName.TableA</resource-name>
+ <allow-read />
+ </permission>
+
+ <permission>
+ <resource-name>modelName.TableA.colum1</resource-name>
+ <allow-read />
+ </permission>
+
+ <mapped-role-name>role2</mapped-role-name>
+ </data-policy>
+</vdb>
+
+ ]]></programlisting>
+
+ <para>The above XML defined two data policies, "policy-1" which allows everything except delete on the table, "policy-2" that
+ allows only read operation on the table. The "mapped-role-name" defines the "role" to whom these policies are applicable. Each data-policy
+ must define a "role" to be enforced by the Teiid Server.</para>
+
+ <para>
+ The above xml assumes that "UserA" has "role1" role and "UserC" has "role2" role and
+ "UserB" does not have either "role1" or "role2" roles.</para>
+
+ <para>For assigning the roles to your users, in the JBoss AS,
+ check out the instructions for the selected Login Module. Check "Admin Guide" for configuring Login Modules.</para>
+
+ <para>"vdb.xml" file is checked against the schema file <code>vdb-deployer.xsd</code>, check the documents sections of the Teiid kit
+ to find a copy of the schema file.</para>
+
+ <note><para>Currently there is no GUI tooling support in the Designer or any other management tool to create this data roles
+ permissions xml, however this is in our roadmap for future releases to provide.</para></note>
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/entitlements.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,460 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="teiid_connection">
+ <title>Connecting to Teiid Server</title>
+
+ <para>The Teiid JDBC API provides Java Database Connectivity (JDBC) access any Virtual Database (VDB) that
+ is deployed in the Teiid Server.
+ The Teiid JDBC API supports the JDBC 4.0 specification; however, it is not fully JDBC Compliant.
+ It does not support advanced features such as updatable result sets or SQL3 data types. </para>
+
+ <para>Java client applications connecting to a Teiid Server will need to use Java 1.6 JDK. Previous versions of Java is
+ is not supported.</para>
+
+ <para>Before you can connect to the Teiid Server using the Teiid JDBC API, please do following tasks first.</para>
+ <orderedlist>
+ <listitem> <para>Install the Teiid Server. Check "Admin Guide" for instructions. </para> </listitem>
+ <listitem> <para>Build a Virtual Database (VDB). You can either build a "Dynamic VDB" (Designer not required),
+ or you can use Eclipse based GUI tool <ulink url="http://www.jboss.org/teiiddesigner.html">Designer</ulink>.
+ Check "Reference Guide" for instructions on how to build a VDB. If you do not know what VDB is, then start with this
+ <ulink url="http://www.jboss.org/teiid/basics/virtualdatabases.html">document</ulink>.</para> </listitem>
+ <listitem> <para>Deploy the VDB into Teiid Server. Check "Admin Guide" for instructions. </para> </listitem>
+ <listitem> <para>Start the Teiid Server (JBoss AS), if it is not already running.</para> </listitem>
+ </orderedlist>
+
+ <para>Now that you have the VDB deployed in Teiid Server, client applications
+ can connect to Teiid Server and issue SQL queries against deployed VDB using Teiid's JDBC API. If you are new to JDBC, learn about
+ <ulink url="http://java.sun.com/docs/books/tutorial/jdbc/index.html">JDBC</ulink> here. Teiid kit ships with
+ <code>teiid-{version}-client.jar</code> in the <code>"jboss-install/server/<profile>/lib"</code> directory. This JAR file
+ contains Teiid JDBC Driver and DataSource classes. Add this JAR to your Java client application's classpath.
+ </para>
+
+ <orderedlist numeration="arabic">
+ <listitem> <para><code>TeiidDriver</code> - JDBC connections using
+ <ulink url="http://java.sun.com/javase/6/docs/api/java/sql/DriverManager.html">DriverManager</ulink> class.</para> </listitem>
+ <listitem> <para><code>TeiidDatasource</code> - JDBC connections using
+ <ulink url="http://java.sun.com/javase/6/docs/api/javax/sql/DataSource.html">DataSource</ulink> class. You can use this to create JDBC XA connections. </para> </listitem>
+ </orderedlist>
+
+ <sect1 id="driver_connection">
+ <title>Driver Based Connection</title>
+ <para>Add the above jar file in your application's class path and use <code>org.teiid.jdbc.TeiidDriver</code> as the driver class.
+ Use the following URL format for JDBC connections:
+ </para>
+
+ <para><emphasis>jdbc:teiid:<vdb-name>@mm[s]://<host>:<port>;[prop-name=prop-value;]*</emphasis></para>
+
+ <para>Where</para>
+ <orderedlist>
+ <listitem><para><vdb-name> - Name of the VDB you are connecting to</para></listitem>
+ <listitem><para>mm - defines Teiid JDBC protocol, mms defines a secure channel (see how to turn on <link linkend="ssl">SSL</link>)</para></listitem>
+ <listitem><para><host> - defines the server where the Teiid Server is installed</para></listitem>
+ <listitem><para><port> - defines the port on which the Teiid Server is listening for incoming JDBC connections.</para></listitem>
+ <listitem><para>[prop-name=prop-value] - additionally you can supply any number of name value pairs separated by semi-colon
+ [;], further refining the connection. All supported URL properties are defined <link linkend="connection_properties">here</link>.</para></listitem>
+ </orderedlist>
+
+ <para>Sample Code:</para>
+ <programlisting><![CDATA[
+ public class TeiidClient {
+ public Connection getConnection(String user, String password) throws Exception {
+ String url = "jdbc:teiid:myVDB@mm://localhost:31000;ApplicationName=myApp";
+ Class.forName("org.teiid.jdbc.TeiidDriver");
+ return DriverManager.getConnection(url, user, password);
+ }
+ }
+ ]]></programlisting>
+
+ </sect1>
+
+ <sect1 id="datasource_connection">
+ <title>Datasource Based Connection</title>
+ <para>To use a data source based connection use <code>org.teiid.jdbc.TeiidDataSource</code> as the data source class.
+ If your JDBC connection needs to participate in an XA transaction, you must use the
+ data source connection. Teiid DataSource class is also Serializable, so it possible for it to be used with
+ JNDI naming services.</para>
+
+ <para>Sample Code:</para>
+ <programlisting><![CDATA[
+ public class TeiidClient {
+ public Connection getConnection(String user, String password) throws Exception {
+ TeiidDataSource ds = new TeiidDataSource();
+ ds.setUser(user);
+ ds.setPassword(password);
+ ds.setServerName("localhost");
+ ds.setPortNumber(31000);
+ ds.setDatabaseName("myVDB");
+ return ds.getConnection();
+ }
+ }
+ ]]></programlisting>
+
+ <para>All the Teiid Data Source supported properties are defined <link linkend="connection_properties">here</link>.</para>
+
+ <note><para>Teiid supports the XA protocol, if all sources that Teiid is integrating
+ also support XA and are configured as XA data sources. If one or more sources are not XA capable, they can be
+ marked as read-only and still participate in an XA transaction with the remaining sources.</para>
+ </note>
+ </sect1>
+
+ <sect1 id="ds_in_jbossas">
+ <title>As Data Source in JBoss AS</title>
+ <para>Teiid can be configured as a JDBC data source in the JBoss Application Server and can be accessed
+ from the JNDI for your JEE application. Deploying Teiid as data source in JBoss AS is exactly same as
+ deploying any other RDBMS resources like Oracle or DB2. </para>
+
+ <para>Defining as data source is not limited to
+ JBoss AS, you can also deploy as data source in Glassfish, Tomcat, Websphere, Weblogic etc servers, however their
+ configuration files are different than JBoss AS. Consult the respective documentation of the environment
+ in which you are deploying.</para>
+ <orderedlist numeration="arabic">
+ <listitem><para>Copy the <code>teiid-${version}-client.jar</code> into
+ <code><jboss-install>/server/default/lib</code> directory.</para></listitem>
+ <listitem><para>Create a "teiid-ds.xml" file in <code><jboss-install>/server/<profile>/deploy</code>
+ directory. Based on the type of deployment the contents of the deployment file will look like the below
+ code fragment.</para></listitem>
+ </orderedlist>
+ <sect2 id="as_xa_connection">
+ <title>DataSource based connection</title>
+ <para>The below XML code sample will create an XA data source in the JBoss AS using the
+ Teiid DataSource class <code>org.teiid.jdbc.TeiidDataSource</code>. Make sure
+ you supply the correct DatabaseName, ServerName, Port number and credentials that are specific
+ to your deployment environment. Then deploy this file into the JBoss AS and access the above data source from
+ the JNDI in your JEE application with the specified JNDI name.</para>
+
+ <programlisting><![CDATA[
+ <datasources>
+ <xa-datasource>
+ <jndi-name>TEIID-DS</jndi-name>
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
+ <xa-datasource-property name="DatabaseName">myVDB</xa-datasource-property>
+ <xa-datasource-property name="serverName">localhost</xa-datasource-property>
+ <xa-datasource-property name="portNumber">31000</xa-datasource-property>
+ <xa-datasource-property name="user">admin</xa-datasource-property>
+ <xa-datasource-property name="password">password</xa-datasource-property>
+ <track-connection-by-tx>true</track-connection-by-tx>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <no-tx-separate-pools />
+
+ <!-- pool and other JBoss datasource properties -->
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>10</max-pool-size>
+ </xa-datasource>
+ </datasources>
+ ]]></programlisting>
+ </sect2>
+ <sect2 id="as_driver_connection">
+ <title>Driver based connection</title>
+ <para>You can also use Teiid's JDBC driver class <code>org.teiid.jdbc.TeiidDriver</code> to create a data source</para>
+ <programlisting><![CDATA[
+ <datasources>
+ <local-tx-datasource>
+ <jndi-name>TEIID-DS</jndi-name>
+ <connection-url>jdbc:metamatrix:myVDB@mm://localhost:31000</connection-url>
+ <driver-class>org.teiid.jdbc.TeiidDriver</driver-class>
+ <user-name>admin</user-name>
+ <password>teiid</password>
+
+ <!-- pool and other JBoss datasource properties -->
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>10</max-pool-size>
+ </local-tx-datasource>
+ </datasources>
+ ]]></programlisting>
+ </sect2>
+ <sect2 id="local_connection">
+ <title>Local JDBC Connection</title>
+ <para>If you are deploying your client application on the same JBoss AS instance as the Teiid runtime is installed, then
+ there is no reason for your client application to open socket based JDBC connection, as the
+ both applications are running in the same Java VM process.
+ You can use slightly modified data source configuration to make the "local" connection, that does not involve socket based
+ communication. Here is an example:</para>
+ <programlisting><![CDATA[
+ <datasources>
+ <xa-datasource>
+ <jndi-name>TEIID-DS</jndi-name>
+ <xa-datasource-class>org.teiid.jdbc.TeiidDataSource</xa-datasource-class>
+ <xa-datasource-property name="DatabaseName">myVDB</xa-datasource-property>
+ <xa-datasource-property name="user">admin</xa-datasource-property>
+ <xa-datasource-property name="password">password</xa-datasource-property>
+ <track-connection-by-tx>true</track-connection-by-tx>
+ <isSameRM-override-value>false</isSameRM-override-value>
+ <no-tx-separate-pools />
+
+ <!-- pool and other JBoss datasource properties -->
+ <min-pool-size>5</min-pool-size>
+ <max-pool-size>10</max-pool-size>
+ </xa-datasource>
+ </datasources>
+ ]]></programlisting>
+ <para>In the absense of the "ServerName" and "PortNumber", the JDBC API will lookup a local Teiid runtime in
+ the same VM.</para>
+ </sect2>
+
+ </sect1>
+
+ <sect1>
+ <title>Using Multiple Hosts</title>
+ <para>When Teiid Server is deployed on multiple servers for scalbility, then your application that using
+ Teiid JDBC API can automatically use all Teiid Servers in that group. To enable this feature the client application needs
+ to specify all the Teiid Servers connection information (host name and port number) on the URL connection string. During the
+ connection and authentication, client will randomly pick any one the Teiid server from the list and will have session
+ established with that server. In the case of failure of the connected server, the client will try to automatically failover
+ to other available servers, if the "autoFailover" connection property is set to "true". Here is example URL connection string</para>
+
+ <programlisting><![CDATA[
+ jdbc:teiid:<vdb-name>@mm://host1:31000, host1:31001, host2:31000;version=2
+ ]]></programlisting>
+
+ <para>Currently when the fail over happens, the user is re-authenticated with the new server. The clustering
+ feature coming up in the Teiid 7.1 release will define how the transparent session fail over will occur with out the
+ re-authentication.</para>
+
+ <para>You can also use this feature to distribute the query load among various avaialble Teiid Servers available.
+ Load balancing happens automatically, when you are using a data source along with connection pooling. Each time a connection is
+ grabbed from the pool, it will randomly select a Teiid Server to distribute the load. Note, that load balacing feature
+ is not avaialble if you are using Teiid Driver to make your connection.</para>
+
+ <para>If you are using DataSource to connect to Teiid Server, use "AlternateServers" property/method to define the failover servers.
+ Check out the Javadoc on the format of the string.</para>
+ </sect1>
+
+ <sect1 id="connection_properties">
+ <title>JDBC Connection Properties</title>
+ <para>The following table shows all the supported connection properties that can used with Teiid
+ JDBC Driver URL connection string, or on the Teiid JDBC Data Source class.</para>
+
+ <table frame='all'>
+ <title>Connection Properties</title>
+ <tgroup cols='3' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*" />
+ <colspec colname='c2' colwidth="1*" />
+ <colspec colname='c3' colwidth="2*" />
+ <thead>
+ <row>
+ <entry>Property Name</entry>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <code>ApplicationName</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Name of the client application; allows the administrator to identify the connections</entry>
+ </row>
+ <row>
+ <entry>
+ <code>FetchSize</code>
+ </entry>
+ <entry>
+ <code>int</code>
+ </entry>
+ <entry>Size of the resultset; The default size if 500. <=0 indicates that the value is not set</entry>
+ </row>
+ <row>
+ <entry>
+ <code>partialResultsMode</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Enable/disable support partial results mode. Default is "off". Allowed values are "on" or "off"</entry>
+ </row>
+ <row>
+ <entry>
+ <code>autoCommitTxn</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Only applies only when "autoCommit" is set to "true".
+
+ This determines how a executed command needs to be transactionally wrapped inside the
+ Teiid engine to maintain the data integrity.
+ <orderedlist>
+ <listitem><para>ON - Always wrap command in distributed transaction</para></listitem>
+ <listitem><para>OFF - Never wrap command in distributed transaction</para></listitem>
+ <listitem><para>DETECT (default)- If the executed command is spanning more than one source it automatically uses distributed transaction.</para></listitem>
+ </orderedlist>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>disableLocalTxn</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry> If "true", the autoCommit setting, commit and rollback will be ignored for local transactions.</entry>
+ </row>
+ <row>
+ <entry>
+ <code>user</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>User name</entry>
+ </row>
+ <row>
+ <entry>
+ <code>Password</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Credential for user</entry>
+ </row>
+ <row>
+ <entry>
+ <code>ansiQuotedIdentifiers</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>Sets the parsing behavior for double quoted entries in SQL. The default, true, parses dobuled
+ quoted entries as identifiers. If set to false, then double quoted values that
+ are valid string literals will be parsed as string literals.</entry>
+ </row>
+ <row>
+ <entry>
+ <code>version</code>
+ </entry>
+ <entry>
+ <code>integer</code>
+ </entry>
+ <entry>Version number of the VDB</entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>resultSetCacheMode</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>ResultSet caching is turned on/off; Valid values are true|false</entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>SHOWPLAN</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Can be one of ON|OFF|DEBUG</entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>NoExec</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>true|false</entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>autoFailover</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>If true, will automatically select a new server instance after a communication exception.</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>All the above properties have "set" methods on the <code>org.teiid.jdbc.TeiidDataSource</code>.
+ Some of the the properties that are assumed from the URL string have addtional "set" methods, those proeprties are described in the
+ following table.</para>
+
+ <table frame='all'>
+ <title>Datasource Properties</title>
+ <tgroup cols='3' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*" />
+ <colspec colname='c2' colwidth="1*" />
+ <colspec colname='c3' colwidth="2*" />
+ <thead>
+ <row>
+ <entry>Property Name</entry>
+ <entry>Type</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <code>DatabaseName</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>The name of a virtual database (VDB) deployed to Teiid</entry>
+ </row>
+ <row>
+ <entry>
+ <code>ServerName</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Server where the Teiid runtime installed</entry>
+ </row>
+ <row>
+ <entry>
+ <code>PortNumber</code>
+ </entry>
+ <entry>
+ <code>integer</code>
+ </entry>
+ <entry>Port number on which the Server process is listening on.</entry>
+ </row>
+ <row>
+ <entry>
+ <code>secure</code>
+ </entry>
+ <entry>
+ <code>boolean</code>
+ </entry>
+ <entry>Secure connection. Flag to indicate to use SSH based connection between client and server</entry>
+ </row>
+ <row>
+ <entry>
+ <code>DatabaseVersion</code>
+ </entry>
+ <entry>
+ <code>integer</code>
+ </entry>
+ <entry>VDB version</entry>
+ </row>
+ <row>
+ <entry>
+ <code>DataSourceName</code>
+ </entry>
+ <entry>
+ <code>String</code>
+ </entry>
+ <entry>Name given to this data source</entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <para>Once you have established a connection with the Teiid Server, you can use any standard JDBC API like
+ DatabaseMetadata and ResultSetMetadata classes to interrogate metadata of the deployed VDB. You can also use
+ data processing classes and objects and process the results. </para>
+ </sect1>
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-connection.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,355 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="jdbc_extensions">
+ <title>Teiid extensions to the JDBC API</title>
+
+ <sect1>
+ <title>Statement Extensions</title>
+ <para>Teiid provides some extensions to the JDBC statement interface. The Teiid Statement extension interface
+ is defined by <code>org.teiid.jdbc.TeiidStatement</code>. To use the extension interface, simply
+ cast or unwap the statement returned by the Connection to the extension interface.
+ The following methods are provided on the extension interface:</para>
+
+ <table frame='all'>
+ <title>Connection Properties</title>
+ <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*" />
+ <colspec colname='c2' colwidth="2*" />
+ <thead>
+ <row>
+ <entry>Method Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <code>getAnnotations()</code>
+ </entry>
+ <entry>
+ <code>Get the query engine annotations if the previously executed command used OPTION PLANONLY or OPTION SHOWPLAN</code>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>getDebugLog()</code>
+ </entry>
+ <entry>
+ <code>Get the debug log if the previously executed command used OPTION DEBUG.</code>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>getExecutionProperty(String)</code>
+ </entry>
+ <entry>
+ <code>Get the current value of an execution property on this statement object.</code>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>getPlanDescription()</code>
+ </entry>
+ <entry>
+ <code>Get the query plan description if the previously executed command used OPTION PLANONLY or OPTION SHOWPLAN.</code>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>getRequestIdentifier()</code>
+ </entry>
+ <entry>
+ <code>Get an identifier for the last command executed on this statement. If no command has been executed yet, null is returned.</code>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>setExecutionProperty(String, String)</code>
+ </entry>
+ <entry>
+ <code>Set the execution property on this statement. Execution properties are described in more detail below.</code>
+ </entry>
+ </row>
+
+ <row>
+ <entry>
+ <code>setPayload(Serializable)</code>
+ </entry>
+ <entry>
+ <code>Set a per-command payload to pass to translators. Currently
+ this only used for sending hints for Oracle
+ data source. For security purposes, this is no longer recommended.</code>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+
+ <sect2>
+ <title>Debug Information</title>
+
+ <para>Debug information is only returned when using query options.
+ These options are set on the session using the
+ <code>SET</code> keyword. The available options for debugging purposes are:</para>
+
+ <itemizedlist>
+ <para>SET Syntax:
+ </para>
+ <listitem>
+ <para>SET parameter value
+ </para>
+ </listitem>
+ </itemizedlist>
+ <itemizedlist>
+ <para>Syntax Rules:
+ </para>
+ <listitem>
+ <para>Both parameter and value must be simple literals - they cannot contain spaces.</para>
+ </listitem>
+ <listitem>
+ <para>The value is also not treated as an expression and will not be evaluated prior to being set as the parameter value.</para>
+ </listitem>
+ </itemizedlist>
+ <para>The SET command can be used to control planning and execution.
+ </para>
+ <itemizedlist>
+ <listitem>
+ <para>SET SHOWPLAN [ON|DEBUG|OFF] - ON returns the query plan along with the results and DEBUG additionally prints the query planner debug information in the log and returns it with the results. Both the plan and the log are available through JDBC API extensions.</para>
+ </listitem>
+ <listitem>
+ <para>SET NOEXEC [ON|OFF] - ON prevents query execution, but parsing and planning will still occur.</para>
+ </listitem>
+ </itemizedlist>
+
+ <para>Use the Statement object to execute the above command to set the required options.</para>
+
+ <para><emphasis>getDebugLog()</emphasis> - method can be used to obtain the output from
+ the <code>SET SHOWPLAN DEBUG</code> option.</para>
+
+ <para><emphasis>getPlanDescription()</emphasis> - method be used to obtain the query plan from SET SHOWPLAN ON.
+ The plan is a tree made up of <code>PlanNode</code> objects. The <code>PlanNode</code> interface is
+ also in the <code>org.teiid.client.plan</code> package. A PlanNode simply has a set of properties and
+ the ability to traverse to a parent node and the child nodes. The property keys in the
+ query plan nodes are dependent on the type of plan and the command itself.</para>
+
+ <para><emphasis>getAnnotations()</emphasis> - method can be called to obtain any annotations
+ objects. Each annotation contains a description,
+ a category, a severity, and possibly a resolution of notes recorded during query planning
+ that can be used to understand choices made by the query planner. This is also available when SET SHOWPLAN is used.</para>
+ </sect2>
+
+ <sect2 id="execution_properties">
+ <title>Execution Properties</title>
+ <para>When your application executes queries, it can specify optional features for each query.
+ Your application can use some of these options only in certain contexts. These execution properties
+ share a common interface when they are being set. The execution properties are defined by
+ constants in the <code>org.teiid.jdbc.ExecutionProperties</code> interface.</para>
+ <para>You can get and set the following execution properties to modify the behavior of query execution by calling
+ <code>setExecutionProperty</code> method on the <code>org.teiid.jdbc.TeiidStatement</code> class.</para>
+
+ <table frame='all'>
+ <title>Execution Properties</title>
+ <tgroup cols='2' align='left' colsep='1' rowsep='1'>
+ <colspec colname='c1' colwidth="1*" />
+ <colspec colname='c2' colwidth="2*" />
+ <thead>
+ <row>
+ <entry>Property Name</entry>
+ <entry>Description</entry>
+ </row>
+ </thead>
+ <tbody>
+ <row>
+ <entry>
+ <code>PROP_TXN_AUTO_WRAP</code>
+ </entry>
+ <entry>
+ <para>Determines how transactions are automatically wrapped used with
+ commands when auto commit mode is set to “true”. Does not affect transaction
+ behavior when auto commit mode is set to “false”. See
+ <link linkend="jdbc_transactions">“Transactions with JDBC”</link> for more information.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>PROP_PARTIAL_RESULTS_MODE</code>
+ </entry>
+ <entry>
+ <para>Determines whether partial results mode is used for this query or not.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>PROP_XML_FORMAT</code>
+ </entry>
+ <entry>
+ <para>Determines the formatting of the returned XML documents. The two supported
+ formats are XML_TREE_FORMAT, which is a formatted tree with indentation and
+ linefeeds or XML_COMPACT_FORMAT which is a compact message with no extra whitespace.
+ If no value is set for this property (the default), then the formatting mode
+ specified in the XML document model is used.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>PROP_XML_VALIDATION</code>
+ </entry>
+ <entry>
+ <para>Determines whether xml result documents will be validated
+ against their schema before being returned. If schema validation fails,
+ a warning message is returned along with the result documents.
+ Using validation significantly reduces performance.</para>
+ </entry>
+ </row>
+ <row>
+ <entry>
+ <code>RESULT_SET_CACHE_MODE</code>
+ </entry>
+ <entry>
+ <para>Result set caching provides caching of complete result sets based on exact query matches.
+ Result set caching is not enabled by default. Result set caching needs to enabled on Server too.
+ Once result set caching is enabled, all user
+ queries will use the result set cache. Additional control is provided in the JDBC
+ driver to turn off use of the result set cache on a per-query basis.</para>
+ </entry>
+ </row>
+ </tbody>
+ </tgroup>
+ </table>
+ <para>Each of these properties are described in detail in the following sections.</para>
+ </sect2>
+
+ <sect2>
+ <title>Partial Results Mode</title>
+ <para>The Teiid Server supports a “partial results” query mode. This mode changes the behavior of the
+ query processor so the server returns results even when some data sources are unavailable.</para>
+
+ <para>For example, suppose that two data sources exist for different suppliers and your
+ data Designers have created a virtual group that creates a union between the information
+ from the two suppliers. If your application submits a query without using partial
+ results query mode and one of the suppliers’ databases is down, the query
+ against the virtual group returns an exception. However, if your application runs
+ the same query in “partial results” query mode, the server returns data from the
+ running data source and no data from the data source that is down.</para>
+
+ <para>When using “partial results” mode, if a source throws an exception during
+ processing it does not cause the user’s query to fail. Rather, that source is treated
+ as returning no more rows after the failure point.
+ Most commonly, that source will return 0 rows. </para>
+
+ <para>This behavior is most useful when using <code>UNION</code> or <code>OUTER JOIN</code> queries
+ as these operations handle missing information in a useful way. Most
+ other kinds of queries will simply return 0 rows to the user
+ when used in partial results mode and the source is unavailable. </para>
+
+ <para>For each source that is excluded from the query, a warning will be generated
+ describing the source and the failure. These warnings can be obtained from the
+ <code>ResultSet.getWarnings()</code> method. This method returns a <code>SQLWarning</code> object but
+ in the case of “partial results” warnings, this will be an object of
+ type <code>org.teiid.jdbc.PartialResultsWarning</code> class. This class can be
+ used to obtain a list of all the failed sources by name and to obtain
+ the specific exception thrown by each resource adaptor. </para>
+
+ <para>Below is an example of printing the list of failed sources:</para>
+ <programlisting><![CDATA[
+ statement.setExecutionProperty(PROP_PARTIAL_RESULTS_MODE, “true”);
+ ResultSet results = statement.executeQuery(“SELECT Name FROM Accounts”);
+ SQLWarning warning = results.getWarnings();
+ if(warning instanceof PartialResultsWarning) {
+ PartialResultsWarning partialWarning = (PartialResultsWarning) warning;
+ Collection failedConnectors = partialWarning.getFailedConnectors();
+ Iterator iter = failedConnectors.iterator();
+ while(iter.hasNext()) {
+ String connectorName = (String) iter.next();
+ SQLException connectorException = partialWarning.getConnectorException(connectorName);
+ System.out.println(connectorName + “: “ +ConnectorException.getMessage();
+ }
+ }
+ ]]></programlisting>
+ </sect2>
+
+ <sect2>
+ <title>XML extensions</title>
+ <para>Your application can use a statement object to execute queries that return XML documents.
+ The query must specify a valid document in VDB, or should have used SQL XML functions
+ to create a XMl document. When your
+ application executes an XML query, the Teiid Server returns a ResultSet
+ object that has a single column named xml and often a single row, which
+ represents a document. Depending on the XML virtual document model,
+ multiple documents may be returned</para>
+ <sect3>
+ <title>XML Streaming</title>
+ <para>XML documents are streamed from Teiid Server to the Teiid JDBC API.
+ Normally, the document never materializes in the server memory, avoiding potential
+ out-of-memory issues and improving the first response time for large documents.
+ When using style sheets, schema validation, or XQuery, the whole document
+ must be materialized on the server. Therefore memory issues may occur for large documents.
+ A result document can be obtained from the JDBC resultset using <code>getSQLXML</code> method.
+ </para>
+ <para>The document is broken into pieces when being created and streamed.
+ The maximum size of each piece in the stream can be configured with the
+ <code>"lobChunkSizeInKB"</code> system property on the Server. The default value is 100 KB.
+ At any given time, this is the maximum amount of memory that can be held by a particular
+ XML query against the system. In heavily loaded or memory-constrained scenarios,
+ this value can decrease the amount of memory used. As a side effect, streaming will o
+ ccur in smaller pieces, reducing initial document response time while
+ increasing full response time (as this is less efficient). Conversely, increasing this value in
+ lightly loaded scenarios uses more server memory and increase the initial
+ response time but can make the full response time less</para>
+ </sect3>
+
+ <sect3>
+ <title>Document formatting</title>
+ <para>The PROP_XML_FORMAT execution property can be set to modify the way that
+ XML documents are formatted on return. Valid values for the constant
+ are defined in the same ExecutionProperties interface:</para>
+ <orderedlist>
+ <listitem><para><code>XML_TREE_FORMAT</code> - Returns a version of the XML formatted for display.
+ The XML will use line breaks and tabs as appropriate to format the XML as a tree.
+ This format is slower due to the formatting time and the larger document size.</para></listitem>
+ <listitem><para><code>XML_COMPACT_FORMAT</code> - Returns a version of the XML formatted for
+ optimal performance. The XML is a single long string without any
+ unnecessary white space. </para></listitem>
+ <listitem><para>Not Set - If no format is set, the formatting flag on the
+ XML document in the original model is honored.</para></listitem>
+ </orderedlist>
+ <para>The default is to set neither format and to use the formatting flag specified
+ in the document model itself. This may produce either the “tree” or “compact”
+ form of the document depending on the document setting. </para>
+ </sect3>
+
+ <sect3>
+ <title>Schema validation</title>
+ <para>The <code>PROP_XML_VALIDATION</code> execution property can be set to indicate that
+ the server should validate documents against their schema before returning them
+ to the client. If schema validation is on, then the server will throw
+ an exception if the document does not conform to the schema it is associated with.
+ Using schema validation will reduce the performance of your XML queries. </para>
+
+ <note><para>Schema validation must materialize the entire document on the server to
+ validate the schema. Thus, schema validation will prevent streaming of
+ XML results and may increase server memory usage.</para></note>
+
+ </sect3>
+ </sect2>
+
+ </sect1>
+
+ <sect1>
+ <title>ResultSet Limitations</title>
+ <orderedlist>
+ <listitem><para>Supports only <code>FORWARD_ONLY</code> and <code>SCROLL_INSENSITIVE</code> scroll modes. </para></listitem>
+ <listitem><para>Supports only <code>READ_ONLY</code> result sets. <code>UPDATABLE</code> ResultSets are not supported.</para></listitem>
+ <listitem><para>Returning multiple ResultSets from Procedure execution is not supported.</para></listitem>
+ <listitem><para>Closing the ResultSet does not close the Statement object. Statement must be closed to free the resources.</para> </listitem>
+ </orderedlist>
+ </sect1>
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-extensions.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-transactions.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-transactions.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-transactions.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,214 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="jdbc_transactions">
+ <title>Transactions with JDBC</title>
+ <para>The Teiid JDBC API supports three types of transactions from a
+ client perspective – global, local, and request level. All are implemented
+ by the Teiid Server as XA transactions.
+ See the <ulink url="http://java.sun.com/javaee/technologies/jta/index.jsp">JTA specification</ulink> for more on XA Transactions.</para>
+
+ <note><para>Even though in client application, Teiid data source is viewed as single source, Teiid
+ itself may be integrating data from multiple data sources underneath. So, any transaction under
+ Teiid that involves more than single source is performed as a XA transaction. These
+ transaction scopes define the user
+ application's interaction with Teiid runtime.</para></note>
+
+ <sect1>
+ <title>Using Local Transactions</title>
+ <para>The Connection class uses the "autoCommit" flag to explicitly control local transactions. By default, autoCommit
+ is set to "true", which indicates request level or implicit transaction control. Following is an example of
+ how to use local transactions by setting the autoCommit flag to false.</para>
+
+ <programlisting><![CDATA[
+ // Set auto commit to false and start a transaction
+ connection.setAutoCommit(false);
+
+ try {
+ // Execute multiple updates
+ Statement statement = connection.createStatement();
+ statement.executeUpdate(“INSERT INTO Accounts (ID, Name) VALUES (10, ‘Mike’)”);
+ statement.executeUpdate(“INSERT INTO Accounts (ID, Name) VALUES (15, ‘John’)”);
+ statement.close();
+
+ // Commit the transaction
+ connection.commit();
+
+ } catch(SQLException e) {
+ // If an error occurs, rollback the transaction
+ connection.rollback();
+ }
+ ]]></programlisting>
+ <para>This example demonstrates several things:</para>
+ <orderedlist numeration="arabic">
+ <listitem> <para>Setting autoCommit flag to false. This will start a transaction bound to the current JDBC client thread.</para> </listitem>
+ <listitem> <para>Executing multiple updates within the context of the transaction.</para> </listitem>
+ <listitem> <para>When the statements are complete, the transaction is committed by calling commit().</para> </listitem>
+ <listitem> <para>If an error occurs, the transaction is rolled back using the rollback() method.</para> </listitem>
+ </orderedlist>
+ <para>Any of the following operations will end a local transaction:</para>
+ <orderedlist>
+ <listitem> <para>Connection.setAutoCommit(true) – if previously set to false</para> </listitem>
+ <listitem> <para>Connection.commit()</para> </listitem>
+ <listitem> <para>Connection.rollback()</para> </listitem>
+ <listitem> <para>A transaction will be rolled back automatically if it times out.</para> </listitem>
+ </orderedlist>
+ <sect2>
+ <title>Turning Off Local Transactions</title>
+ <para>In some cases, tools or frameworks above Teiid will call setAutoCommit(false), commit() and rollback()
+ even when all access is read-only and no transactions are necessary.
+ In the scope of a local transaction Teiid will start and attempt to commit an XA transaction,
+ possibly complicating configuration or causing performance degradation.</para>
+
+ <para>In these cases, you can override the default JDBC behavior to indicate that these methods
+ should perform no action regardless of the commands being executed. To turn off the use of local transactions,
+ add this property to the JDBC connection URL</para>
+
+ <programlisting><![CDATA[
+ disableLocalTxn=true
+ ]]></programlisting>
+
+ <note><para>WARNING:Turning off local transactions can be dangerous and can result in inconsistent
+ results (if reading data) or inconsistent data in data stores (if writing data).
+ For safety, this mode should be used only if you are certain that
+ the calling application does not need local transactions.</para></note>
+ </sect2>
+ </sect1>
+
+ <sect1>
+ <title>Using Request Level Transactions</title>
+ <para>Request level transactions will be implicitly used when the request is not in the
+ scope of a global or local transaction, which implies "autoCommit" is "true". In a request
+ level transaction, your application does not need to explicitly call commit or rollback,
+ rather every command is assumed to be its own transaction that will automatically
+ be committed or rolled back by the server.</para>
+
+ <para>The Teiid Server can perform updates through virtual tables. These updates might
+ result in an update against multiple physical systems, even though the application issues
+ the update command against a single virtual table. Often, a user might not know whether
+ the queried tables actually update multiple sources and require a transaction.</para>
+
+ <para>For that reason, the Teiid Server allows your application to automatically wrap commands
+ in transactions when necessary. Because this wrapping incurs a performance penalty for your queries,
+ you can choose from a number of available wrapping modes to suit your environment. You need to choose
+ between the highest degree of integrity and performance your application needs.
+ For example, if your data sources are not transaction-compliant, you might turn the transaction
+ wrapping off (completely) to maximize performance.
+ </para>
+
+ <para>you can set your transaction wrapping to one of the following modes.</para>
+
+ <programlisting><![CDATA[
+ autoCommitTxn=ON|OFF|DETECT
+ ]]></programlisting>
+
+
+ <orderedlist>
+ <listitem> <para><emphasis>ON</emphasis>: This mode always wraps every command in a transaction
+ without checking whether it is required. This is the safest mode.</para></listitem>
+ <listitem> <para><emphasis>OFF</emphasis>: This mode never automatically wraps a command in a
+ transaction or check whether it needs to wrap a command. This mode can be dangerous as it will
+ allow multi-source updates outside of a transaction without an error. This mode has best
+ performance for applications that do not use updates or transactions.</para></listitem>
+ <listitem> <para> <emphasis>DETECT</emphasis>: This mode assumes that the user does not know to execute
+ multi-source updates in a transaction. The Teiid Server checks every command to see whether it
+ is a multi-source update and wraps it in a transaction. If it is single source then uses
+ the source level command transaction.</para></listitem>
+ </orderedlist>
+
+ <para>You can set the transaction mode as a property when you establish the Connection or on a
+ per-query basis using the execution properties. For more information on execution
+ properties, see the section <link linkend="execution_properties">“Execution Properties”</link></para>
+ </sect1>
+
+ <sect1>
+ <title>Using Global Transactions</title>
+ <para>Global or client XA transactions allow the Teiid JDBC API to participate in transactions that
+ are beyond the scope of a single client resource. For this use the Teiid DataSource Class for establishing connections.</para>
+
+ <para>When the DataSource is used in the context of a UserTransaction in an application server,
+ such as JBoss, WebSphere, or Weblogic, the resulting connection will already be
+ associated with the current XA transaction. No additional client JDBC code is
+ necessary to interact with the XA transaction.</para>
+
+ <para>Applications may also utilize Teiid JDBC XA transactions manually, such as shown in the following example:</para>
+ <programlisting><![CDATA[
+ XAConnection xaConn = null;
+ XAResource xaRes = null;
+ Connection conn = null;
+ Statement stmt = null;
+
+ try {
+ xaConn = <DataSource instance>.getXAConnection();
+ xaRes = xaConn.getXAResource();
+ Xid xid = <new Xid instance>;
+ conn = xaConn.getConnection();
+ stmt = conn.createStatement();
+
+ xaRes.start(xid, XAResource.TMNOFLAGS);
+ stmt.executeUpdate("insert into …");
+ <other statements on this connection or other resources enlisted in this transaction>
+ xaRes.end(xid, XAResource.TMSUCCESS);
+
+ if (xaRes.prepare(xid) == XAResource.XA_OK) {
+ xaRes.commit(xid, false);
+ }
+ }
+ catch (XAException e) {
+ xaRes.rollback(xid);
+ }
+ finally {
+ <clean up>
+ }
+ ]]></programlisting>
+
+ <para>With the use of global transactions multiple Teiid XAConnections may participate in the
+ same transaction. It is important to note that the Teiid JDBC XAResource "isSameRM" method only returns
+ "true", if connections are made to the same server instance in a cluster. If the Teiid connections are to different
+ server instances then transactional behavior may not be the same as if they were to the same cluster member.
+ For example, if the client transaction manager uses the same XID for each connection, duplicate XID exceptions
+ may arise from the same physical source accessed through different cluster members.
+ If the client transaction manager uses a different branch identifier for each connection, issues may arise
+ with sources that lock or isolate changes based upon branch identifiers.</para>
+ </sect1>
+
+ <sect1>
+ <title>SELECT INTO Transaction</title>
+ <para>The <code>SELECT INTO</code> command, even against a single source, requires a transaction.
+ Issuing a <code>SELECT INTO</code> command from within a virtual procedure or from client application requires
+ users to do one of the following:</para>
+
+ <orderedlist>
+ <listitem><para>Use XA connectors with a global, local, or request level (automatic wrapping set
+ to DETECT or ON) transaction.</para></listitem>
+ <listitem><para>Do not use s global or local transaction and set the automatic
+ wrapping to OFF to intentionally avoid using a transaction.</para></listitem>
+ </orderedlist>
+ </sect1>
+
+ <sect1>
+ <title>Transaction Restrictions</title>
+ <sect2>
+ <title>Application Restrictions</title>
+ <para>The use of global, local, and request level transactions are all mutually exclusive.
+ Request level transactions only apply when not in a global or local transaction. Any attempt to
+ mix global and local transactions concurrently will result in an exception.</para>
+ </sect2>
+
+ <sect2>
+ <title>Enterprise Information System Support</title>
+ <para>The underlying resource adaptors that represent the EIS system and the EIS system itself must support XA transactions
+ if they want to participate in distributed XA transaction thru Teiid. If
+ source system do not support the XA, then it can not particilate in the distributed transaction. However, the source is still
+ eligible to participate in data integration usecase with out the XA support, however it will not be part of the on going
+ transaction.</para>
+
+ <para>The participation in the XA
+ transaction is automatically determined based on the resource adaptors XA capability. It is user's repsonsiblity to make sure
+ that they configure a XA resource when they require them to participate in distributed transaction.
+ </para>
+ </sect2>
+ </sect1>
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/jdbc-transactions.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/other_commands.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/other_commands.xml 2010-06-23 17:10:08 UTC (rev 2286)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/other_commands.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
-<chapter id="other_commands">
- <title>Other Commands</title>
- <sect1 id="set_command">
- <title>SET Command</title>
- <para>The SET command is used to set execution property values for the duration of the session.</para>
- <itemizedlist>
- <para>SET Syntax:
- </para>
- <listitem>
- <para>SET parameter value
- </para>
- </listitem>
- </itemizedlist>
- <itemizedlist>
- <para>Syntax Rules:
- </para>
- <listitem>
- <para>Both parameter and value must be simple literals - they cannot contain spaces.</para>
- </listitem>
- <listitem>
- <para>The value is also not treated as an expression and will not be evaluated prior to being set as the parameter value.</para>
- </listitem>
- </itemizedlist>
- <para>The SET command can be used to control planning and execution.
- </para>
- <itemizedlist>
- <listitem>
- <para>SET SHOWPLAN [ON|DEBUG|OFF] - ON returns the query plan along with the results and DEBUG additionally prints the query planner debug information in the log and returns it with the results. Both the plan and the log are available through JDBC API extensions.</para>
- </listitem>
- <listitem>
- <para>SET NOEXEC [ON|OFF] - ON prevents query execution, but parsing and planning will still occur.</para>
- </listitem>
- </itemizedlist>
- </sect1>
-</chapter>
\ No newline at end of file
Modified: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml 2010-06-23 17:10:08 UTC (rev 2286)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/ssl.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,263 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="ssl">
+ <title>Secure Client Connections using SSL in Teiid</title>
+
+ <para>This chapter will shows you various security configurations
+ that can be used with Teiid in securing your data access. Note that data level
+ security (<link linkend="entitlements">data entitlements</link>) are explained in separate chapter.</para>
+
+ <sect1 id="default_security">
+ <title>Default Security</title>
+ <para>By default, access to Teiid is NOT secure. The login modules are only
+ backed by file based authentication, and it also creates well known user
+ name and password for easy access for users who want to give a quick try of the Teiid.
+ The same is also true for making the connection to the Admin Console application that Teiid provides.
+ However, we DO NOT recommend leaving the default security profile as defined when you
+ are exposing sensitive data. Check out the "Admin Guide" for instructions as to how to
+ configure different login modules to secure the access.</para>
+
+ <para>This chapter is dedicated to discuss about securing the communication channels,
+ like the socket connection between your client application and Teiid Server. If you are always using a
+ <link linkend="local_connection">local connection</link>, then you may not need to secure the channels as
+ cleint and server are in the same VM process.</para>
+
+ <para>By default all sensitive (non-data) messages between client and server
+ are encrypted using a <ulink url="http://en.wikipedia.org/wiki/Diffie-Hellman_key_exchange">Diffy-Hellman</ulink>
+ key that is negotiated per connection. This
+ encryption is controlled by <code>clientEncryptionEnabled</code> property in <code>JdbcSslConfiguration</code> and
+ <code>AdminSslConfiguration</code> sections
+ in <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code> file. So, the
+ passwords are never sent in the clear channel during session establishment.</para>
+ </sect1>
+
+ <sect1 id="ssl_modes">
+ <title>SSL Modes</title>
+ <para>Teiid supports SSL based channel between the client JDBC application and Teiid Server. Teiid supports the following
+ SSL modes.</para>
+ <orderedlist>
+ <listitem><para>Anonymous – No certificates are required, but all communications are still
+ encrypted using the TLS_DH_anon_WITH_AES_128_CBC_SHA SSL suite.</para></listitem>
+ <listitem><para>1-way – Only authenticates the server to the client traffic. Requires a private key keystore to be created
+ for the server and a truststore at the client that authenticates that key. The SSL suite is negotiated.</para></listitem>
+ <listitem><para>2-way – Mutual client and server authentication. The server and client applications
+ each have a keystore for their private keys and each has a truststore that authenticates the other.</para></listitem>
+ </orderedlist>
+
+ <para>Depending upon the SSL mode, follow the guidelines of your organization around creating/obtaining
+ private keys. If you have no organizational requirements, then follow this guide to create
+ <link linkend="appendix-selfcerts">self-signed certificates</link> with their respective keystores and truststores.</para>
+ <para>The following keystore and truststore combinations are required for different SSL modes. The names of
+ the files can be chosen by the user. The following files are shown for example purposes only.</para>
+
+ <para><emphasis>1-way</emphasis> </para>
+ <orderedlist>
+ <listitem><para>server.keystore - has server's private key</para></listitem>
+ <listitem><para>server.truststore - has server's public key</para></listitem>
+ </orderedlist>
+
+ <para><emphasis>2-way</emphasis> </para>
+ <orderedlist>
+ <listitem><para>server.keystore - has server's private key</para></listitem>
+ <listitem><para>server.truststore - has server's public key</para></listitem>
+ <listitem><para>client.keystore - client's private key</para></listitem>
+ <listitem><para>client.truststore - has client's public key</para></listitem>
+ </orderedlist>
+ <para>or</para>
+ <orderedlist>
+ <listitem><para>server.keystore - has server's private key, client's pulic key</para></listitem>
+ <listitem><para>client.keystore - client's private key, and server's public key</para></listitem>
+ </orderedlist>
+ </sect1>
+
+ <sect1 id="connfigure_server">
+ <title>Configuring SSL in Teiid Server</title>
+ <para>The Teiid's configuration file
+ <code><jboss-install>/server/<profile>/deploy/teiid/teiid-jboss-beans.xml</code>,
+ contains the properties to configure SSL. Teiid Server, has two separate connection profiles. One for the JDBC
+ connections and the other for the Admin connections. They both have separate SSL configuration
+ properties, so besure to know which properties that you are editing.</para>
+ <orderedlist>
+ <listitem><para>JDBC Connection - The <code>JdbcSslConfiguration</code> bean configuration defines this.</para></listitem>
+ <listitem><para>Admin Connection - The <code>AdminSslConfiguration</code> bean configuration defines this.</para></listitem>
+ </orderedlist>
+ <para>The configurations look same as below sample.</para>
+ <programlisting><![CDATA[
+ <bean name="JdbcSslConfiguration" class="org.teiid.transport.SSLConfiguration">
+ <property name="sslEnabled">false</property>
+ <property name="keystoreFilename">cert.keystore</property>
+ <property name="keystorePassword">passwd</property>
+ <property name="keystoreType">JKS</property>
+ <property name="sslProtocol">SSLv3</property>
+ <property name="keymanagementAlgorithm">false</property>
+ <property name="truststoreFilename">cert.truststore</property>
+ <property name="truststorePassword">passwd</property>
+ <!-- 1-way, 2-way, anonymous -->
+ <property name="authenticationMode">1-way</property>
+ <property name="clientEncryptionEnabled">true</property>
+ </bean>
+ ]]></programlisting>
+ <para>The properties are described below.</para>
+ <orderedlist>
+ <listitem><para>sslEnabled - true|false, SSL usage either turned ON or OFF </para></listitem>
+ <listitem><para>sslProtocol- Type of SSL protocol to be used. Default is SSLv3</para></listitem>
+ <listitem><para>keystoreType - Keystore type created by the keytool. Default "JKS" is used.</para></listitem>
+ <listitem><para>authenticationMode - anonymous|1-way|2-way, Type of SSL mode, see
+ above about different <link linkend="ssl_modes">SSL modes</link> available.</para></listitem>
+ <listitem><para>keymanagementAlgorithm - Type of key algorithm used. Default
+ is based upon the VM, e.g. "SunX509"</para></listitem>
+ <listitem><para>keystoreFilename - The file name of the keystore, which contains the
+ private key of the Server. This must be available in the classpath of Teiid Server</para></listitem>
+ <listitem><para>keystorePassword - password for the keystore.</para></listitem>
+ <listitem><para>truststoreFilename - if "authenticationMode" is chosen
+ as "2-way", then this property must be provided. This is the truststore that contains the
+ public key for the client. Depending upon how you created the keystore and truststores,
+ this may be same file as defined under "keystoreFilename" property.</para></listitem>
+ <listitem><para>truststorePassword - password for the truststore. </para></listitem>
+ </orderedlist>
+
+ <para>Once all the properties are defined, make sure the certificates are in the right place, then restart the
+ Teiid server to start accepting connections using SSL.</para>
+ </sect1>
+
+ <sect1 id="configure_client">
+ <title>Configuring SSL in Teiid's Client</title>
+ <para>Configuring any Java client program with SSL involves modifying scripts that
+ launch the client programs to define few Java VM system properties using "-Dkey=value" format. The
+ following sections define the system properties required for each SSL mode. Note that when
+ connecting to Teiid Server with SSL enabled, you <emphasis>MUST</emphasis> use
+ the <emphasis>"mms"</emphasis> protocol, instead of "mm" in the JDBC connection URL, for example</para>
+
+ <para> jdbc:teiid:<myVdb>@<emphasis>mms</emphasis>://<host>:<port></para>
+
+ <para>There are two different sets of properties that a client can configure to enable 1-way or 2-way SSL.</para>
+
+ <sect2>
+ <title>Option 1: Java SSL properties (recommended)</title>
+ <para>These are standard Java defined system properties to configure the SSL under any JVM, Teiid is not
+ unique in its use of SSL. Provide the following system properties to the client VM process.</para>
+
+ <para>1-way SSL</para>
+ <programlisting><![CDATA[
+ -Djavax.net.ssl.trustStore=<dir>/server.truststore (required)
+ -Djavax.net.ssl.trustStorePassword=<password> (optional)
+ -Djavax.net.ssl.keyStoreType (optional)
+ ]]></programlisting>
+
+ <para>2-way SSL</para>
+ <programlisting><![CDATA[
+ -Djavax.net.ssl.keyStore=<dir>/client.keystore (required)
+ -Djavax.net.ssl.keyStrorePassword=<password> (optional)
+ -Djavax.net.ssl.trustStore=<dir>/server.truststore (required)
+ -Djavax.net.ssl.trustStorePassword=<password> (optioanl)
+ -Djavax.net.ssl.keyStroreType=<keystore type> (optional)
+ ]]></programlisting>
+
+ </sect2>
+
+ <sect2>
+ <title>Option 2: Teiid Specific Properties</title>
+ <para>Use this option for <emphasis>"anonymous"</emphasis> mode or when the above "javax" based properties
+ are already in use by the host process. For example if your client application is a Tomcat
+ process that is configured for https protocol and the above Java based properties are
+ already in use, and importing Teiid-specific certificate keys into those https
+ certificate keystores is not allowed.</para>
+
+ <para>In this scenario, a different set of Teiid-specific SSL properties can be defined inside
+ the "teiid-client-settings.properties" file, such that they do not override the VM specific
+ SSL properties specified for host process. The "teiid-client-settings.properties" file
+ can be found inside the "teiid-{version}-client.jar" file at the root directory location.
+ Extract this file, or make a copy, change the property values required for the chosen SSL mode,
+ and place this file in the client application's classpath before
+ the "teiid-{version}-client.jar" file.</para>
+
+ <para>SSL properties inside "teiid-client-settings.properties" are shown below
+ (read more property comments inline). Provide the following required properties for different SSL modes.
+ </para>
+
+ <programlisting><![CDATA[
+ ########################################
+ # SSL Settings
+ ########################################
+
+ #
+ # The key store type. Defaults to JKS
+ #
+
+ org.teiid.ssl.keyStoreType=JKS
+
+ #
+ # The key store algorithm, defaults to
+ # the system property "ssl.TrustManagerFactory.algorithm"
+ #
+
+ #org.teiid.ssl.algorithm=
+
+ #
+ # The classpath or filesystem location of the
+ # key store.
+ #
+ # This property is required only if performing 2-way
+ # authentication that requires a specific private
+ # key.
+ #
+
+ #org.teiid.ssl.keyStore=
+
+ #
+ # The key store password (not required)
+ #
+
+ #org.teiid.ssl.keyStorePassword=
+
+ #
+ # The classpath or filesystem location of the
+ # trust store.
+ #
+ # This property is required if performing 1-way
+ # authentication that requires trust not provided
+ # by the system defaults.
+ #
+ # Set to NONE for anonymous authentication using
+ # the TLS_DH_anon_WITH_AES_128_CBC_SHA cipher suite
+ #
+
+ #org.teiid.ssl.trustStore=
+
+ #
+ # The trust store password (not required)
+ #
+
+ #org.teiid.ssl.trustStorePassword=
+
+ #
+ # The cipher protocol, defaults to SSLv3
+ #
+
+ org.teiid.ssl.protocol=SSLv3
+
+ ]]></programlisting>
+
+ <para>1-way SSL</para>
+ <programlisting><![CDATA[
+ org.teiid.ssl.trustStore=<dir>/server.truststore (required)
+ ]]></programlisting>
+
+
+ <para>2-way SSL</para>
+ <programlisting><![CDATA[
+ org.teiid.ssl.keyStore=<dir>/client.keystore (required)
+ org.teiid.ssl.trustStore=<dir>/server.truststore (required)
+ ]]></programlisting>
+
+ <para>Anonymous</para>
+ <programlisting><![CDATA[
+ org.teiid.ssl.trustStore=NONE
+ ]]></programlisting>
+
+ </sect2>
+ </sect1>
+</chapter>
\ No newline at end of file
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,88 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+<chapter id="using_hibernate">
+ <title>Using Teiid with Hibernate</title>
+ <sect1>
+ <title>Limitations</title>
+ <para>Many Hibernate use cases assume a data source has the ability (with proper user permissions)
+ to process Data Definition Language (DDL) statements like CREATE TABLE and DROP TABLE
+ as well as Data Manipulation Language (DML) statements like SELECT, UPDATE, INSERT and DELETE.
+ Teiid can handle a broad range of DML but does not support DDL.</para>
+ </sect1>
+
+ <sect1>
+ <title>Configuration</title>
+ <para>For the most part, interacting with teiid VDBs (Virtual Databases) from Hibernate is no
+ different from working with any other type of data source.
+ First you must place Teiid JDBC API client JAR file and Teiid's hibernate dialect JAR in Hibernate’s classpath.
+ These files can be found in <code><jboss-install>/server/<profile>/lib</code> directory. </para>
+ <orderedlist>
+ <listitem><para>teiid-{version}-client.jar</para></listitem>
+ <listitem><para>teiid-hibernate-dialect-{version}.jar</para></listitem>
+ </orderedlist>
+
+ <para>These JAR files has <code>org.teiid.dialect.TeiidDialect</code> and <code>org.teiid.jdbc.TeiidDriver</code> and
+ <code>org.teiid.jdbc.TeiidDataSource</code> classes.</para>
+
+ <para>You then configure the Hibernate configuration file (hibernate.cfg.xml) as follows: Specify the Teiid driver
+ class in the "connection.driver_class" property:</para>
+
+ <programlisting><![CDATA[
+ <property name="connection.driver_class">
+ org.teiid.jdbc.TeiidDriver
+ </property>
+ ]]></programlisting>
+
+ <para>Specify the URL for the VDB in the "connection.url" property
+ (replacing terms in angle brackets with the appropriate values):</para>
+
+ <programlisting><![CDATA[
+ <property name="connection.url">
+ jdbc:metamatrix:<vdb-name>@mm://<host>:<port>;user=<user-name>;password=<password>
+ </property>
+ ]]></programlisting>
+
+ <para>Specify the Teiid dialect class in the “dialect” property:</para>
+
+ <programlisting><![CDATA[
+ <property name="dialect">
+ org.teiid.dialect.TeiidDialect
+ </property>
+ ]]></programlisting>
+
+ <para>Alternatively, if you put your connection properties in <code>hibernate.properties</code>
+ instead of <code>hibernate.cfg.xml</code>, they would look like this: </para>
+
+ <programlisting><![CDATA[
+ hibernate.connection.driver_class=org.teiid.jdbc.TeiidDriver
+ hibernate.connection.url=jdbc:teiid:<vdb-name>@mm://<host>:<port>
+ hibernate.connection.username=<user-name>
+ hibernate.connection.password=<password>
+ hibernate.dialect=org.teiid.dialect.TeiidDialect
+ ]]></programlisting>
+
+ <para>Note also that since your VDBs will likely contain multiple source and view models
+ with identical table names, you will need to fully qualify table names
+ specified in Hibernate mapping files:</para>
+
+ <programlisting><![CDATA[
+ <class name="<Class name>" table="<Source/view model name>.[<Category/schema name>.]<Table name>">
+ ...
+ </class>
+ ]]></programlisting>
+
+ <para>For Example:</para>
+
+ <programlisting><![CDATA[
+ <class name="org.teiid.example.Publisher" table="BOOKS.BOOKS.PUBLISHERS">
+ ...
+ </class>
+ ]]></programlisting>
+
+ </sect1>
+
+
+</chapter>
\ No newline at end of file
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/content/using-hibernate.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/documentation/client-developers-guide/src/main/docbook/en-US/main.xml
===================================================================
--- trunk/documentation/client-developers-guide/src/main/docbook/en-US/main.xml (rev 0)
+++ trunk/documentation/client-developers-guide/src/main/docbook/en-US/main.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -0,0 +1,58 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<!--
+
+ JBoss, Home of Professional Open Source.
+ Copyright (C) 2008 Red Hat, Inc.
+ Licensed to Red Hat, Inc. under one or more contributor
+ license agreements. See the copyright.txt file in the
+ distribution for a full listing of individual contributors.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ 02110-1301 USA.
+
+-->
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
+<!ENTITY % CustomDTD SYSTEM "../../../../../docbook/custom.dtd">
+%CustomDTD;
+]>
+
+<book>
+
+ <bookinfo>
+ <title>Teiid - Scalable Information Integration</title>
+ <subtitle>Teiid Client Developer's Guide</subtitle>
+ <releaseinfo>&versionNumber;</releaseinfo>
+ <productnumber>&versionNumber;</productnumber>
+ <issuenum>1</issuenum>
+ <copyright>
+ <year>©rightYear;</year>
+ <holder>©rightHolder;</holder>
+ </copyright>
+ <xi:include href="../../../../../docbook/en-US/legal_notice.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ </bookinfo>
+
+ <toc/>
+
+ <xi:include href="content/jdbc-connection.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/jdbc-extensions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/jdbc-transactions.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/ssl.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/entitlements.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/using-hibernate.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/appendix-unsupported-jdbc.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+ <xi:include href="content/appendix-selfcerts.xml" xmlns:xi="http://www.w3.org/2001/XInclude" />
+
+</book>
+
Property changes on: trunk/documentation/client-developers-guide/src/main/docbook/en-US/main.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/documentation/pom.xml
===================================================================
--- trunk/documentation/pom.xml 2010-06-23 17:10:08 UTC (rev 2286)
+++ trunk/documentation/pom.xml 2010-06-23 18:47:52 UTC (rev 2287)
@@ -16,32 +16,6 @@
<module>reference</module>
<module>developer-guide</module>
<module>quick-start-example</module>
+ <module>client-developers-guide</module>
</modules>
- <!--<repositories>
- <repository>
- <id>apiviz.release</id>
- <name>APIviz releases</name>
- <url>http://apiviz.googlecode.com/svn/site/repo/mvn/release</url>
- <releases>
- <enabled>true</enabled>
- </releases>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>-->
- <pluginRepositories>
- <pluginRepository>
- <id>jboss</id>
- <url>http://repository.jboss.com/maven2</url>
- </pluginRepository>
- <pluginRepository>
- <id>jboss-org</id>
- <url>http://repository.jboss.org/maven2</url>
- </pluginRepository>
- <pluginRepository>
- <id>jboss-snapshot</id>
- <url>http://snapshots.jboss.org/maven2</url>
- </pluginRepository>
- </pluginRepositories>
</project>
\ No newline at end of file
14 years, 6 months
teiid SVN: r2286 - branches/7.0.x/engine/src/main/java/org/teiid/query/function/source.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-23 13:10:08 -0400 (Wed, 23 Jun 2010)
New Revision: 2286
Modified:
branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
Log:
TEIID-171 changes to xml logic accounting for woodstox as a possible provider
Modified: branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
===================================================================
--- branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-06-23 17:01:05 UTC (rev 2285)
+++ branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-06-23 17:10:08 UTC (rev 2286)
@@ -88,7 +88,7 @@
*/
public class XMLSystemFunctions {
- private static final String P_OUTPUT_VALIDATE_STRUCTURE = "com.ctc.wstx.outputValidateStructure";
+ private static final String P_OUTPUT_VALIDATE_STRUCTURE = "com.ctc.wstx.outputValidateStructure"; //$NON-NLS-1$
//YEAR 0 in the server timezone. used to determine negative years
public static long YEAR_ZERO;
static String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; //$NON-NLS-1$
@@ -348,23 +348,25 @@
private static void convertReader(Writer writer,
XMLEventWriter eventWriter, Reader r, Type type)
throws XMLStreamException, IOException, FactoryConfigurationError {
- if (!(r instanceof BufferedReader)) {
- r = new BufferedReader(r);
- }
switch(type) {
case CONTENT:
case ELEMENT:
case PI:
- case COMMENT: //write the value directly to the writer
+ case COMMENT: {//write the value directly to the writer
eventWriter.flush();
- int chr = -1;
- while ((chr = r.read()) != -1) {
- writer.write(chr);
+ char[] buf = new char[1 << 13];
+ int read = -1;
+ while ((read = r.read(buf)) != -1) {
+ writer.write(buf, 0, read);
}
break;
+ }
case UNKNOWN: //assume a document
case DOCUMENT: //filter the doc declaration
XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+ if (!(r instanceof BufferedReader)) {
+ r = new BufferedReader(r);
+ }
XMLEventReader eventReader = inputFactory.createXMLEventReader(r);
eventReader = inputFactory.createFilteredReader(eventReader, new EventFilter() {
@Override
@@ -375,11 +377,11 @@
eventWriter.add(eventReader);
break;
case TEXT:
- CharBuffer buffer = CharBuffer.allocate(1 << 13);
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
- while (r.read(buffer) != -1) {
- eventWriter.add(eventFactory.createCharacters(new String(buffer.array(), 0, buffer.position())));
- buffer.reset();
+ char[] buf = new char[1 << 13];
+ int read = -1;
+ while ((read = r.read(buf)) != -1) {
+ eventWriter.add(eventFactory.createCharacters(new String(buf, 0, read)));
}
break;
}
14 years, 6 months
teiid SVN: r2285 - branches/7.0.x/engine/src/main/java/org/teiid/query/function/source.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-23 13:01:05 -0400 (Wed, 23 Jun 2010)
New Revision: 2285
Modified:
branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
Log:
TEIID-171 changes to xml logic accounting for woodstox as a possible provider
Modified: branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java
===================================================================
--- branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-06-23 16:59:49 UTC (rev 2284)
+++ branches/7.0.x/engine/src/main/java/org/teiid/query/function/source/XMLSystemFunctions.java 2010-06-23 17:01:05 UTC (rev 2285)
@@ -88,6 +88,7 @@
*/
public class XMLSystemFunctions {
+ private static final String P_OUTPUT_VALIDATE_STRUCTURE = "com.ctc.wstx.outputValidateStructure";
//YEAR 0 in the server timezone. used to determine negative years
public static long YEAR_ZERO;
static String DATETIME_FORMAT = "yyyy-MM-dd'T'HH:mm:ss"; //$NON-NLS-1$
@@ -148,7 +149,7 @@
public void translate(Writer writer) throws TransformerException,
IOException {
try {
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ XMLOutputFactory factory = getOutputFactory();
XMLEventWriter eventWriter = factory.createXMLEventWriter(writer);
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
for (Evaluator.NameValuePair nameValuePair : values) {
@@ -157,6 +158,7 @@
}
addElement(nameValuePair.name, writer, eventWriter, eventFactory, namespaces, null, Collections.singletonList(nameValuePair.value));
}
+ eventWriter.close();
} catch (XMLStreamException e) {
throw new TransformerException(e);
}
@@ -183,10 +185,11 @@
public void translate(Writer writer) throws TransformerException,
IOException {
try {
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ XMLOutputFactory factory = getOutputFactory();
XMLEventWriter eventWriter = factory.createXMLEventWriter(writer);
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
addElement(name, writer, eventWriter, eventFactory, namespaces, attributes, contents);
+ eventWriter.close();
} catch (XMLStreamException e) {
throw new TransformerException(e);
}
@@ -256,13 +259,14 @@
public void translate(Writer writer) throws TransformerException,
IOException {
try {
- XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ XMLOutputFactory factory = getOutputFactory();
XMLEventWriter eventWriter = factory.createXMLEventWriter(writer);
XMLEventFactory eventFactory = XMLEventFactory.newInstance();
convertValue(writer, eventWriter, eventFactory, xml);
for (Object object : other) {
convertValue(writer, eventWriter, eventFactory, object);
}
+ eventWriter.flush(); //woodstox needs a flush rather than a close
} catch (XMLStreamException e) {
throw new TransformerException(e);
}
@@ -272,6 +276,14 @@
return result;
}
+ private static XMLOutputFactory getOutputFactory() throws FactoryConfigurationError {
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ if (factory.isPropertySupported(P_OUTPUT_VALIDATE_STRUCTURE)) {
+ factory.setProperty(P_OUTPUT_VALIDATE_STRUCTURE, false);
+ }
+ return factory;
+ }
+
public static XMLType xmlPi(String name) {
return xmlPi(name, ""); //$NON-NLS-1$
}
@@ -302,11 +314,11 @@
}
}
- static int convertValue(Writer writer, XMLEventWriter eventWriter, XMLEventFactory eventFactory, Object object) throws IOException,
+ static void convertValue(Writer writer, XMLEventWriter eventWriter, XMLEventFactory eventFactory, Object object) throws IOException,
FactoryConfigurationError, XMLStreamException,
TransformerException {
if (object == null) {
- return 0;
+ return;
}
Reader r = null;
try {
@@ -330,7 +342,6 @@
r.close();
}
}
- return 1;
//TODO: blob - with base64 encoding
}
14 years, 6 months
teiid SVN: r2284 - branches/7.0.x/common-core/src/main/java/org/teiid/core/types.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-23 12:59:49 -0400 (Wed, 23 Jun 2010)
New Revision: 2284
Modified:
branches/7.0.x/common-core/src/main/java/org/teiid/core/types/XMLType.java
Log:
TEIID-1021 ensuring backwards compatibility of xmltype
Modified: branches/7.0.x/common-core/src/main/java/org/teiid/core/types/XMLType.java
===================================================================
--- branches/7.0.x/common-core/src/main/java/org/teiid/core/types/XMLType.java 2010-06-23 16:01:46 UTC (rev 2283)
+++ branches/7.0.x/common-core/src/main/java/org/teiid/core/types/XMLType.java 2010-06-23 16:59:49 UTC (rev 2284)
@@ -26,6 +26,7 @@
import java.io.InputStream;
import java.io.ObjectInput;
import java.io.ObjectOutput;
+import java.io.OptionalDataException;
import java.io.OutputStream;
import java.io.Reader;
import java.io.Writer;
@@ -121,7 +122,11 @@
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
super.readExternal(in);
- this.encoding = (String)in.readObject();
+ try {
+ this.encoding = (String)in.readObject();
+ } catch (OptionalDataException e) {
+ this.encoding = Streamable.ENCODING;
+ }
}
@Override
14 years, 6 months
teiid SVN: r2283 - in trunk: common-core/src/test/java/org/teiid/core/types and 3 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-23 12:01:46 -0400 (Wed, 23 Jun 2010)
New Revision: 2283
Modified:
trunk/common-core/src/main/java/org/teiid/core/util/StringUtil.java
trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java
trunk/common-core/src/test/java/org/teiid/core/types/TestSQLXMLImpl.java
trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java
trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
Log:
TEIID-76 allowing procedures to be vdb qualified
Modified: trunk/common-core/src/main/java/org/teiid/core/util/StringUtil.java
===================================================================
--- trunk/common-core/src/main/java/org/teiid/core/util/StringUtil.java 2010-06-23 02:52:46 UTC (rev 2282)
+++ trunk/common-core/src/main/java/org/teiid/core/util/StringUtil.java 2010-06-23 16:01:46 UTC (rev 2283)
@@ -697,31 +697,10 @@
* @since JDK1. 0
*/
public static boolean startsWithIgnoreCase(final String text, final String prefix) {
- if (isEmpty(text)) {
+ if (text == null || prefix == null) {
return false;
}
- if (prefix == null) {
- return false;
- }
- int textLength = text.length();
- int prefixLength = prefix.length();
- if (prefixLength == 0) {
- return true;
- }
- if (prefixLength > textLength) {
- return false;
- }
- char[] chArray = prefix.toCharArray();
- for (int i = 0; i != chArray.length; ++i) {
- char ch1 = chArray[i];
- char ch2 = text.charAt(i);
- if (ch1 == ch2 || Character.toLowerCase(ch1) == Character.toLowerCase(ch2)) {
- // continue
- } else {
- return false;
- }
- }
- return true;
+ return text.regionMatches(true, 0, prefix, 0, prefix.length());
}
/**
@@ -738,32 +717,10 @@
* suffix argument is null <code>false</code> is returned.
*/
public static boolean endsWithIgnoreCase(final String text, final String suffix) {
- if (isEmpty(text)) {
+ if (text == null || suffix == null) {
return false;
}
- if (suffix == null) {
- return false;
- }
- int textLength = text.length();
- int suffixLength = suffix.length();
- if (suffixLength == 0) {
- return true;
- }
- if (suffixLength > textLength) {
- return false;
- }
- int offset = textLength - suffixLength;
- char[] chArray = suffix.toCharArray();
- for (int i = 0; i != chArray.length; ++i) {
- char ch1 = chArray[i];
- char ch2 = text.charAt(offset + i);
- if (ch1 == ch2 || Character.toLowerCase(ch1) == Character.toLowerCase(ch2)) {
- // continue
- } else {
- return false;
- }
- }
- return true;
+ return text.regionMatches(true, text.length() - suffix.length(), suffix, 0, suffix.length());
}
/**
@@ -1064,4 +1021,5 @@
}
return (String[]) result.toArray(new String[result.size()]);
}
+
}
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java 2010-06-23 02:52:46 UTC (rev 2282)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestClobValue.java 2010-06-23 16:01:46 UTC (rev 2283)
@@ -37,6 +37,7 @@
import org.junit.Test;
import org.teiid.core.util.UnitTestUtil;
+@SuppressWarnings("nls")
public class TestClobValue {
@Test public void testClobValue() throws Exception {
Modified: trunk/common-core/src/test/java/org/teiid/core/types/TestSQLXMLImpl.java
===================================================================
--- trunk/common-core/src/test/java/org/teiid/core/types/TestSQLXMLImpl.java 2010-06-23 02:52:46 UTC (rev 2282)
+++ trunk/common-core/src/test/java/org/teiid/core/types/TestSQLXMLImpl.java 2010-06-23 16:01:46 UTC (rev 2283)
@@ -22,29 +22,24 @@
package org.teiid.core.types;
+import static org.junit.Assert.*;
+
import java.io.IOException;
import java.io.Reader;
import java.sql.SQLException;
import javax.xml.transform.stream.StreamSource;
-import org.teiid.core.types.SQLXMLImpl;
-import org.teiid.core.types.Streamable;
+import org.junit.Test;
import org.teiid.core.util.ObjectConverterUtil;
-import junit.framework.TestCase;
+@SuppressWarnings("nls")
+public class TestSQLXMLImpl {
-
-/**
- * Basically we want to make sure that nobody has changed the fundamental contract
- * of translator
- */
-public class TestSQLXMLImpl extends TestCase {
-
String testStr = "<foo>test</foo>"; //$NON-NLS-1$
//## JDBC4.0-begin ##
- public void testGetSource() throws Exception {
+ @Test public void testGetSource() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
assertTrue(xml.getSource(null) instanceof StreamSource);
@@ -53,57 +48,62 @@
}
//## JDBC4.0-end ##
- public void testGetCharacterStream() throws Exception {
+ @Test public void testGetCharacterStream() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
- assertEquals(testStr, getContents(xml.getCharacterStream()));
+ assertEquals(testStr, ObjectConverterUtil.convertToString(xml.getCharacterStream()));
}
- public void testGetBinaryStream() throws Exception {
+ @Test public void testGetBinaryStream() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
assertEquals(testStr, new String(ObjectConverterUtil.convertToByteArray(xml.getBinaryStream()), Streamable.ENCODING));
}
- public void testGetString() throws Exception {
+ @Test public void testGetString() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
assertEquals(testStr, xml.getString());
}
- public void testSetBinaryStream() throws Exception {
+ @Test(expected=SQLException.class) public void testSetBinaryStream() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
- try {
- xml.setBinaryStream();
- fail("we do not support this yet.."); //$NON-NLS-1$
- } catch (SQLException e) {
- }
+ xml.setBinaryStream();
}
- public void testSetCharacterStream() throws Exception {
+ @Test(expected=SQLException.class) public void testSetCharacterStream() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
- try {
- xml.setCharacterStream();
- fail("we do not support this yet.."); //$NON-NLS-1$
- } catch (SQLException e) {
- }
+ xml.setCharacterStream();
}
- public void testSetString() throws Exception {
+ @Test(expected=SQLException.class) public void testSetString() throws Exception {
SQLXMLImpl xml = new SQLXMLImpl(testStr);
- try {
- xml.setString(testStr);
- fail("we do not support this yet.."); //$NON-NLS-1$
- } catch (SQLException e) {
- }
+ xml.setString(testStr);
}
- private String getContents(Reader reader) throws IOException {
- StringBuffer sb = new StringBuffer();
- int chr = reader.read();
- while(chr != -1) {
- sb.append((char)chr);
- chr = reader.read();
- }
- reader.close();
- return sb.toString();
- }
+ @Test public void testGetString1() throws Exception {
+ SQLXMLImpl clob = new SQLXMLImpl() {
+ public java.io.Reader getCharacterStream() throws java.sql.SQLException {
+ return new Reader() {
+
+ int pos = 0;
+
+ @Override
+ public void close() throws IOException {
+
+ }
+
+ @Override
+ public int read(char[] cbuf, int off, int len)
+ throws IOException {
+ if (pos < 5) {
+ cbuf[off] = 'a';
+ pos++;
+ return 1;
+ }
+ return -1;
+ }
+ };
+ }
+ };
+ assertEquals("aaaaa", clob.getString());
+ }
}
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java 2010-06-23 02:52:46 UTC (rev 2282)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/command/ExecResolver.java 2010-06-23 16:01:46 UTC (rev 2283)
@@ -74,7 +74,22 @@
StoredProcedure storedProcedureCommand = (StoredProcedure) command;
- StoredProcedureInfo storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(storedProcedureCommand.getProcedureName());
+ StoredProcedureInfo storedProcedureInfo = null;
+ try {
+ storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(storedProcedureCommand.getProcedureName());
+ } catch (QueryMetadataException e) {
+ String[] parts = storedProcedureCommand.getProcedureName().split("\\.", 2); //$NON-NLS-1$
+ if (parts.length > 1 && parts[0].equalsIgnoreCase(metadata.getVirtualDatabaseName())) {
+ try {
+ storedProcedureInfo = metadata.getStoredProcedureInfoForProcedure(parts[1]);
+ storedProcedureCommand.setProcedureName(parts[1]);
+ } catch(QueryMetadataException e1) {
+ }
+ }
+ if (storedProcedureInfo == null) {
+ throw e;
+ }
+ }
storedProcedureCommand.setUpdateCount(storedProcedureInfo.getUpdateCount());
storedProcedureCommand.setModelID(storedProcedureInfo.getModelID());
Modified: trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java 2010-06-23 02:52:46 UTC (rev 2282)
+++ trunk/engine/src/main/java/org/teiid/query/resolver/util/ResolverUtil.java 2010-06-23 16:01:46 UTC (rev 2283)
@@ -879,22 +879,16 @@
// If that didn't work, try to strip a vdb name from potentialID
String vdbName = null;
if(groupID == null) {
- String newPotentialID = potentialID;
- int vdbIndex = potentialID.indexOf(ElementSymbol.SEPARATOR);
- if(vdbIndex >= 0) {
- String potentialVdbName = potentialID.substring(0, vdbIndex);
- if (potentialVdbName.equalsIgnoreCase(metadata.getVirtualDatabaseName())) {
- newPotentialID = potentialID.substring(vdbIndex+1);
-
- try {
- groupID = metadata.getGroupID(newPotentialID);
- vdbName = potentialVdbName;
- } catch(QueryMetadataException e) {
- // ignore - just didn't find it
- }
- if(groupID != null) {
- potentialID = newPotentialID;
- }
+ String[] parts = potentialID.split("\\.", 2); //$NON-NLS-1$
+ if (parts.length > 1 && parts[0].equalsIgnoreCase(metadata.getVirtualDatabaseName())) {
+ try {
+ groupID = metadata.getGroupID(parts[1]);
+ } catch(QueryMetadataException e) {
+ // ignore - just didn't find it
+ }
+ if(groupID != null) {
+ potentialID = parts[1];
+ vdbName = parts[0];
}
}
}
Modified: trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2010-06-23 02:52:46 UTC (rev 2282)
+++ trunk/engine/src/test/java/org/teiid/query/resolver/TestProcedureResolving.java 2010-06-23 16:01:46 UTC (rev 2283)
@@ -1619,4 +1619,8 @@
TestResolver.helpResolve(proc.toString(), FakeMetadataFactory.example1Cached(), null);
}
+ @Test public void testVDBQualified() throws Exception {
+ helpResolve("EXEC myvdb.pm1.vsp29()", FakeMetadataFactory.example1Cached()); //$NON-NLS-1$
+ }
+
}
14 years, 6 months
teiid SVN: r2282 - in trunk: connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle and 2 other directories.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-22 22:52:46 -0400 (Tue, 22 Jun 2010)
New Revision: 2282
Removed:
trunk/connectors/translator-jdbc/src/test/java/org/teiid/connector/
Modified:
trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java
trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
Log:
TEIID-968 updating the oracle timestamp literal translation
Modified: trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java
===================================================================
--- trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-06-22 20:53:33 UTC (rev 2281)
+++ trunk/client/src/main/java/org/teiid/jdbc/StatementImpl.java 2010-06-23 02:52:46 UTC (rev 2282)
@@ -77,9 +77,6 @@
private ConnectionImpl driverConnection;
private Properties execProps;
- // the string which is the XSLT style sheet
- private String styleSheet;
-
// fetch size value. This is the default fetch size used by the server
private int fetchSize = BaseDataSource.DEFAULT_FETCH_SIZE;
@@ -821,7 +818,6 @@
reqMsg.setExecutionPayload(this.payload);
reqMsg.setCursorType(this.resultSetType);
reqMsg.setFetchSize(this.fetchSize);
- reqMsg.setStyleSheet(this.styleSheet);
reqMsg.setRowLimit(this.maxRows);
reqMsg.setTransactionIsolation(this.driverConnection.getTransactionIsolation());
@@ -870,23 +866,6 @@
}
/**
- * <p> This method sets a style sheet to this object. The style sheet is
- * to perform transformations.
- * @param reader The reader object from which the styleSheet is to be read
- * @throws IOException if unable to read the style sheet from the Reader object.
- */
- public void attachStylesheet(Reader reader) throws IOException {
- this.styleSheet = ObjectConverterUtil.convertToString(reader);
- }
-
- /**
- * <p> This method removes any existing style sheet on this object.
- */
- public void clearStylesheet() {
- this.styleSheet = null;
- }
-
- /**
* Get Query plan description.
* If the Statement has a resultSet, we get the plan description from the result set
* If that plan description is null, though, we return the very first plan description
Modified: trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java
===================================================================
--- trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-06-22 20:53:33 UTC (rev 2281)
+++ trunk/connectors/translator-jdbc/src/main/java/org/teiid/translator/jdbc/oracle/OracleExecutionFactory.java 2010-06-23 02:52:46 UTC (rev 2282)
@@ -29,6 +29,7 @@
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.sql.Timestamp;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Arrays;
@@ -53,10 +54,10 @@
import org.teiid.logging.LogConstants;
import org.teiid.logging.LogManager;
import org.teiid.metadata.Column;
+import org.teiid.translator.ExecutionContext;
+import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.Translator;
import org.teiid.translator.TranslatorException;
-import org.teiid.translator.ExecutionContext;
-import org.teiid.translator.SourceSystemFunctions;
import org.teiid.translator.TypeFacility;
import org.teiid.translator.jdbc.AliasModifier;
import org.teiid.translator.jdbc.ConvertModifier;
@@ -70,6 +71,11 @@
@Translator(name="oracle")
public class OracleExecutionFactory extends JDBCExecutionFactory {
+ private static final String TIME_FORMAT = "HH24:MI:SS"; //$NON-NLS-1$
+ private static final String DATE_FORMAT = "YYYY-MM-DD"; //$NON-NLS-1$
+ private static final String DATETIME_FORMAT = DATE_FORMAT + " " + TIME_FORMAT; //$NON-NLS-1$
+ private static final String TIMESTAMP_FORMAT = DATETIME_FORMAT + ".FF"; //$NON-NLS-1$
+
/*
* Spatial Functions
*/
@@ -142,17 +148,17 @@
return Arrays.asList("trunc(cast(",function.getParameters().get(0)," AS date))"); //$NON-NLS-1$ //$NON-NLS-2$
}
});
- convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "YYYY-MM-DD")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", "HH24:MI:SS")); //$NON-NLS-1$ //$NON-NLS-2$
+ convertModifier.addConvert(FunctionModifier.DATE, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", DATE_FORMAT)); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.TIME, FunctionModifier.STRING, new ConvertModifier.FormatModifier("to_char", TIME_FORMAT)); //$NON-NLS-1$
convertModifier.addConvert(FunctionModifier.TIMESTAMP, FunctionModifier.STRING, new FunctionModifier() {
@Override
public List<?> translate(Function function) {
//if column and type is date, just use date format
Expression ex = function.getParameters().get(0);
- String format = "YYYY-MM-DD HH24:MI:SS.FF"; //$NON-NLS-1$
+ String format = TIMESTAMP_FORMAT;
if (ex instanceof ColumnReference) {
if ("date".equals(((ColumnReference)ex).getMetadataObject().getNativeType())) { //$NON-NLS-1$
- format = "YYYY-MM-DD HH24:MI:SS"; //$NON-NLS-1$
+ format = DATETIME_FORMAT;
}
} else if (!(ex instanceof Function) && !(ex instanceof Literal)) {
//this isn't needed in every case, but it's simpler than inspecting the expression more
@@ -161,9 +167,9 @@
return Arrays.asList("to_char(", ex, ", '", format, "')"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
});
- convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DATE, new ConvertModifier.FormatModifier("to_date", "YYYY-MM-DD")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIME, new ConvertModifier.FormatModifier("to_date", "HH24:MI:SS")); //$NON-NLS-1$ //$NON-NLS-2$
- convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier("to_timestamp", "YYYY-MM-DD HH24:MI:SS.FF")); //$NON-NLS-1$ //$NON-NLS-2$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.DATE, new ConvertModifier.FormatModifier("to_date", DATE_FORMAT)); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIME, new ConvertModifier.FormatModifier("to_date", TIME_FORMAT)); //$NON-NLS-1$
+ convertModifier.addConvert(FunctionModifier.STRING, FunctionModifier.TIMESTAMP, new ConvertModifier.FormatModifier("to_timestamp", TIMESTAMP_FORMAT)); //$NON-NLS-1$
convertModifier.addTypeConversion(new ConvertModifier.FormatModifier("to_char"), FunctionModifier.STRING); //$NON-NLS-1$
//NOTE: numeric handling in Oracle is split only between integral vs. floating/decimal types
convertModifier.addTypeConversion(new ConvertModifier.FormatModifier("to_number"), //$NON-NLS-1$
@@ -511,6 +517,16 @@
}
@Override
+ public String translateLiteralTimestamp(Timestamp timestampValue) {
+ if (timestampValue.getNanos() == 0) {
+ String val = formatDateValue(timestampValue);
+ val = val.substring(0, val.length() - 2);
+ return "to_date('" + val + "', '" + DATETIME_FORMAT + "')"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ }
+ return super.translateLiteralTimestamp(timestampValue);
+ }
+
+ @Override
public boolean supportsInlineViews() {
return true;
}
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java 2010-06-22 20:53:33 UTC (rev 2281)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestDayWeekQuarterFunctionModifier.java 2010-06-23 02:52:46 UTC (rev 2282)
@@ -63,9 +63,9 @@
}
public void test1() throws Exception {
- Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+ Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 10000000), Timestamp.class);
helpTestMod(arg1, SourceSystemFunctions.DAYOFYEAR,
- "to_number(TO_CHAR({ts '2004-01-21 10:05:00.0'}, 'DDD'))"); //$NON-NLS-1$
+ "to_number(TO_CHAR({ts '2004-01-21 10:05:00.01'}, 'DDD'))"); //$NON-NLS-1$
}
public void test2() throws Exception {
@@ -75,9 +75,9 @@
}
public void test9() throws Exception {
- Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+ Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 10000000), Timestamp.class);
helpTestMod(arg1, SourceSystemFunctions.QUARTER,
- "to_number(TO_CHAR({ts '2004-01-21 10:05:00.0'}, 'Q'))"); //$NON-NLS-1$
+ "to_number(TO_CHAR({ts '2004-01-21 10:05:00.01'}, 'Q'))"); //$NON-NLS-1$
}
public void test10() throws Exception {
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java 2010-06-22 20:53:33 UTC (rev 2281)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestMonthOrDayNameFunctionModifier.java 2010-06-23 02:52:46 UTC (rev 2282)
@@ -62,9 +62,9 @@
}
public void test1() throws Exception {
- Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+ Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 10000000), Timestamp.class);
helpTestMod(arg1, "Month", //$NON-NLS-1$
- "rtrim(TO_CHAR({ts '2004-01-21 10:05:00.0'}, 'Month'))"); //$NON-NLS-1$
+ "rtrim(TO_CHAR({ts '2004-01-21 10:05:00.01'}, 'Month'))"); //$NON-NLS-1$
}
public void test2() throws Exception {
@@ -74,9 +74,9 @@
}
public void test3() throws Exception {
- Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 0), Timestamp.class);
+ Literal arg1 = LANG_FACTORY.createLiteral(TimestampUtil.createTimestamp(104, 0, 21, 10, 5, 0, 10000000), Timestamp.class);
helpTestMod(arg1, "Day", //$NON-NLS-1$
- "rtrim(TO_CHAR({ts '2004-01-21 10:05:00.0'}, 'Day'))"); //$NON-NLS-1$
+ "rtrim(TO_CHAR({ts '2004-01-21 10:05:00.01'}, 'Day'))"); //$NON-NLS-1$
}
public void test4() throws Exception {
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java 2010-06-22 20:53:33 UTC (rev 2281)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleConvertModifier.java 2010-06-23 02:52:46 UTC (rev 2282)
@@ -497,18 +497,18 @@
// Source = TIMESTAMP
@Test public void testTimestampToString() throws Exception {
- Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
- helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts '2003-11-01 12:05:02.0'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
+ Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);
+ helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "string", "to_char({ts '2003-11-01 12:05:02.01'}, 'YYYY-MM-DD HH24:MI:SS.FF')"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testTimestampToDate() throws Exception {
- Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
- helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "trunc(cast({ts '2003-11-01 12:05:02.0'} AS date))"); //$NON-NLS-1$ //$NON-NLS-2$
+ Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);
+ helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "date", "trunc(cast({ts '2003-11-01 12:05:02.01'} AS date))"); //$NON-NLS-1$ //$NON-NLS-2$
}
@Test public void testTimestampToTime() throws Exception {
- Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 0);
- helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "case when {ts '2003-11-01 12:05:02.0'} is null then null else to_date('1970-01-01 ' || to_char({ts '2003-11-01 12:05:02.0'}, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS') end"); //$NON-NLS-1$ //$NON-NLS-2$
+ Timestamp ts = TimestampUtil.createTimestamp(103, 10, 1, 12, 5, 2, 10000000);
+ helpTest(LANG_FACTORY.createLiteral(ts, Timestamp.class), "time", "case when {ts '2003-11-01 12:05:02.01'} is null then null else to_date('1970-01-01 ' || to_char({ts '2003-11-01 12:05:02.01'}, 'HH24:MI:SS'), 'YYYY-MM-DD HH24:MI:SS') end"); //$NON-NLS-1$ //$NON-NLS-2$
}
}
Modified: trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java
===================================================================
--- trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2010-06-22 20:53:33 UTC (rev 2281)
+++ trunk/connectors/translator-jdbc/src/test/java/org/teiid/translator/jdbc/oracle/TestOracleTranslator.java 2010-06-23 02:52:46 UTC (rev 2282)
@@ -564,9 +564,16 @@
@Test public void testTimestampLiteral() throws Exception {
helpTestVisitor(getTestVDB(),
+ "select {ts '2002-12-31 13:59:59.1'} FROM parts", //$NON-NLS-1$
+ null,
+ "SELECT {ts '2002-12-31 13:59:59.1'} FROM PARTS"); //$NON-NLS-1$
+ }
+
+ @Test public void testTimestampLiteral1() throws Exception {
+ helpTestVisitor(getTestVDB(),
"select {ts '2002-12-31 13:59:59'} FROM parts", //$NON-NLS-1$
null,
- "SELECT {ts '2002-12-31 13:59:59.0'} FROM PARTS"); //$NON-NLS-1$
+ "SELECT to_date('2002-12-31 13:59:59', 'YYYY-MM-DD HH24:MI:SS') FROM PARTS"); //$NON-NLS-1$
}
@Test public void testUnionOrderByWithThreeBranches() throws Exception {
14 years, 6 months
teiid SVN: r2281 - in trunk/engine/src: test/java/org/teiid/query/optimizer and 1 other directory.
by teiid-commits@lists.jboss.org
Author: shawkins
Date: 2010-06-22 16:53:33 -0400 (Tue, 22 Jun 2010)
New Revision: 2281
Modified:
trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
Log:
TEIID-1107 adding the ability to raise criteria if it's been pushed too far.
Modified: trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2010-06-22 19:56:42 UTC (rev 2280)
+++ trunk/engine/src/main/java/org/teiid/query/optimizer/relational/rules/RuleRaiseAccess.java 2010-06-22 20:53:33 UTC (rev 2281)
@@ -179,7 +179,7 @@
while (selectRoot.getParent() != null && selectRoot.getParent().getType() == NodeConstants.Types.SELECT) {
selectRoot = selectRoot.getParent();
}
- if (selectRoot.getParent() == null || selectRoot.getParent().getType() == NodeConstants.Types.PROJECT) {
+ if (selectRoot.getParent() == null || (selectRoot.getParent().getType() & (NodeConstants.Types.PROJECT|NodeConstants.Types.GROUP)) == selectRoot.getParent().getType()) {
return null;
}
PlanNode grandParent = selectRoot.getParent();
Modified: trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java
===================================================================
--- trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2010-06-22 19:56:42 UTC (rev 2280)
+++ trunk/engine/src/test/java/org/teiid/query/optimizer/TestAggregatePushdown.java 2010-06-22 20:53:33 UTC (rev 2281)
@@ -37,7 +37,7 @@
import org.teiid.query.unittest.FakeMetadataFactory;
import org.teiid.translator.SourceSystemFunctions;
-
+@SuppressWarnings("nls")
public class TestAggregatePushdown {
public static BasicSourceCapabilities getAggregateCapabilities() {
@@ -867,5 +867,37 @@
1 // UnionAll
});
}
+
+ /**
+ * Ensures that we do not raise criteria over a group by
+ * TODO: check if the criteria only depends on grouping columns
+ */
+ @Test public void testForCase836073GroupBy() throws Exception {
+ String sql = "select count(*) from bqt1.smallb where formatdate(bqt1.smallb.DateValue,'yyyyMM') = '200309'";
+ // Plan query
+ ProcessorPlan plan = TestOptimizer.helpPlan(sql,
+ FakeMetadataFactory.exampleBQTCached(),
+ null, getAggregatesFinder(),
+ new String[] {"SELECT g_0.DateValue FROM bqt1.smallb AS g_0"},
+ TestOptimizer.ComparisonMode.EXACT_COMMAND_STRING );
+
+ TestOptimizer.checkNodeTypes(plan, new int[] {
+ 1, // Access
+ 0, // DependentAccess
+ 0, // DependentSelect
+ 0, // DependentProject
+ 0, // DupRemove
+ 1, // Grouping
+ 0, // Join
+ 0, // MergeJoin
+ 0, // Null
+ 0, // PlanExecution
+ 1, // Project
+ 1, // Select
+ 0, // Sort
+ 0 // UnionAll
+ });
+ }
+
}
14 years, 6 months