License Statement
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Acknowledgements
Microsoft®, Windows®, Windows NT®, Windows® XP, and Windows Vista® are U.S. registered trademarks of Microsoft Corporation. Intel® and Intel® Itanium® are trademarks of Intel Corporation in the U.S. and other countries. Java® is a registered trademark of Oracle and/or its affiliates. Motif, OSF/1, UNIX®, X/Open®, and the X device is a trademark of X/Open Company Ltd. in the UK and other countries.
OSF, OSF/1, OSF/Motif, Motif, and Open Software Foundation are trademarks of the Open Software Foundation in the U.S. and other countries. © 1990, 1991, 1992, 1993 Open Software Foundation, Inc.
The OSF documentation and the OSF software to which it relates are derived in part from materials supplied by the following: © 1987, 1988, 1989 Carnegie-Mellon University. © 1989, 1990, 1991 Digital Equipment Corporation. © 1985, 1988, 1989, 1990 Encore Computer Corporation. © 1988 Free Software Foundation, Inc. © 1987, 1988, 1989, 1990, 1991 Hewlett-Packard Company. © 1985, 1987, 1988, 1989, 1990, 1991, 1992 International Business Machines Corporation. © 1988, 1989 Massachusetts Institute of Technology. © 1988, 1989, 1990 Mentat Inc. © 1988 Microsoft Corporation. © 1987, 1988, 1989, 1990, 1991, 1992 SecureWare, Inc. © 1990, 1991 Siemens Nixdorf Informations systeme AG. © 1986, 1989, 1996, 1997 Sun Microsystems, Inc. © 1989, 1990, 1991 Transarc Corporation.
OSF software and documentation are based in part on the Fourth Berkeley Software Distribution under license from The Regents of the University of California. OSF acknowledges the following individuals and institutions for their role in its development: Kenneth C.R.C. Arnold, Gregory S. Couch, Conrad C. Huang, Ed James, Symmetric Computer Systems, Robert Elz. © 1980, 1981, 1982, 1983, 1985, 1986, 1987, 1988, 1989 Regents of the University of California. OSF MAKES NO WARRANTY OF ANY KIND WITH REGARD TO THE OSF MATERIAL PROVIDED HEREIN, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. OSF shall not be liable for errors contained herein or for incidental consequential damages in connection with the furnishing, performance, or use of this material.
Revision History
Version | Date |
---|---|
2.2.0 |
TBD |
2.1.0 |
May 1, 2017 |
2.0.1 |
July 7, 2016 |
2.0.0 |
June 6, 2016 |
1.3.0 |
January, 2016 |
1. About This Document
This manual describes how to install and configure client applications that enable you to connect to and use a Trafodion database.
1.1. Intended Audience
This manual is intended for users who want to connect to and use a Trafodion database.
1.2. New and Changed Information
This manual shows updated versions for Trafodion Release 2.4.0.
1.3. Notation Conventions
This list summarizes the notation conventions for syntax presentation in this manual.
-
UPPERCASE LETTERS
Uppercase letters indicate keywords and reserved words. Type these items exactly as shown. Items not enclosed in brackets are required.
SELECT
-
lowercase letters
Lowercase letters, regardless of font, indicate variable items that you supply. Items not enclosed in brackets are required.
file-name
-
[ ] Brackets
Brackets enclose optional syntax items.
DATETIME [start-field TO] end-field
A group of items enclosed in brackets is a list from which you can choose one item or none.
The items in the list can be arranged either vertically, with aligned brackets on each side of the list, or horizontally, enclosed in a pair of brackets and separated by vertical lines.
For example:
DROP SCHEMA schema [CASCADE] DROP SCHEMA schema [ CASCADE | RESTRICT ]
-
{ } Braces
Braces enclose required syntax items.
FROM { grantee [, grantee ] ... }
A group of items enclosed in braces is a list from which you are required to choose one item.
The items in the list can be arranged either vertically, with aligned braces on each side of the list, or horizontally, enclosed in a pair of braces and separated by vertical lines.
For example:
INTERVAL { start-field TO end-field } { single-field } INTERVAL { start-field TO end-field | single-field }
-
| Vertical Line
A vertical line separates alternatives in a horizontal list that is enclosed in brackets or braces.
{expression | NULL}
-
… Ellipsis
An ellipsis immediately following a pair of brackets or braces indicates that you can repeat the enclosed sequence of syntax items any number of times.
ATTRIBUTE[S] attribute [, attribute] ... {, sql-expression } ...
An ellipsis immediately following a single syntax item indicates that you can repeat that syntax item any number of times.
For example:
expression-n ...
-
Punctuation
Parentheses, commas, semicolons, and other symbols not previously described must be typed as shown.
DAY (datetime-expression) @script-file
Quotation marks around a symbol such as a bracket or brace indicate the symbol is a required character that you must type as shown.
For example:
"{" module-name [, module-name] ... "}"
-
Item Spacing
Spaces shown between items are required unless one of the items is a punctuation symbol such as a parenthesis or a comma.
DAY (datetime-expression) DAY(datetime-expression)
If there is no space between two items, spaces are not permitted. In this example, no spaces are permitted between the period and any other items:
myfile.sh
-
Line Spacing
If the syntax of a command is too long to fit on a single line, each continuation line is indented three spaces and is separated from the preceding line by a blank line.
This spacing distinguishes items in a continuation line from items in a vertical list of selections.
match-value [NOT] LIKE _pattern [ESCAPE esc-char-expression]
1.4. Comments Encouraged
We encourage your comments concerning this document. We are committed to providing documentation that meets your needs. Send any errors found, suggestions for improvement, or compliments to user@trafodion.apache.org.
Include the document title and any comment, error found, or suggestion for improvement you have concerning this document.
2. Introduction
This manual describes how to install and configure the following client applications, which enable you to connect to and use a Trafodion database.
2.1. Client Summary
2.1.1. JDBC-Based Clients
The following table lists JDBC-based clients supported by Trafodion.
Client Name | Description |
---|---|
Trafodion JDBC Type 4 Driver |
A driver that enables Java applications that run on a client workstation to connect to a Trafodion database. |
Trafodion Command Interface (trafci) |
A command-line interface that allows you to connect to a Trafodion database and run SQL statements and other commands interactively or from script files. For more information, see the Trafodion Command Interface Guide. |
DBVisualizer |
A third-party database tool that allows you to connect to a Trafodion database. For more information, see the DbVisualizer website. |
SQuirreL SQL Client |
A third-party database tool that allows you to connect to a Trafodion database. For more information, see the SQuirreL SQL Client website. |
2.1.2. ODBC-Based Clients
The following table lists ODBC-based clients supported by Trafodion.
Client Name | Description |
---|---|
Trafodion ODBC Driver for Linux |
A driver that enables applications, which were developed for the Microsoft ODBC API and run on a Linux workstation, to connect to a Trafodion database. |
Trafodion ODBC Driver for Windows |
[Not included in this release]1 |
Trafodion odb tool |
A multi-threaded, ODBC-based command-line tool for parallel data loading and extracting. For more information, see the Trafodion odb User Guide. |
Tableau |
An interactive data visualization products focused on business intelligence For more information, see the Tableau Software website. |
1 License issues prevent us from including the ODBC Driver for Windows in this release. Contact user@trafodion.apache.org for help obtaining the driver.
3. Preparation
Trafodion provides JDBC and ODBC drivers plus clients that use those drivers. In addition, you can configure third-party JDBC- and ODBC-based tools to work with Trafodion.
Typically, you install and configure the client software in the following order:
-
JDBC and/or ODBC drivers. (Depending on what clients you plan to use.)
-
Trafodion clients. For example, trafci and odb.
-
Third-party clients. For example, DBVisualizer, SQuirell, and/or Tableau.
If you don’t plan to use JDBC-based clients, then please skip ahead to Download Client Software.
3.1. Java Setup
The Trafodion JDBC Type 4 Driver requires Java 1.7 or higher. You need to set the Java path to the correct location.
Depending on your planned usage, you install the Java Development Kit (JDK, if you plan to develop Java-based applications) or the Java Runtime Environment (JRE, if you plan to use packaged JDBC-based products only).
3.1.1. Verify Java Version
To display the Java version of the client workstation on the screen, enter:
java -version
C:\> java -version
java version "1.7.0_45" # This is the version you need to check
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
C:\>
If the version is not 1.7 or higher, then please upgrade you Java installation See Install Java.
If the version is 1.7 or higher, then skip ahead to Download Client Software.
'java' is not recognized as an internal or external command, operable program or batch file.`
If you have installed Java, then this message indicates that you’ve not included the Java directory in your search path. See Set Up PATH Variable.
3.1.2. Install Java
Refer to: http://www.java.com/en/download.
Once installed, follow the instruction in Set Up PATH Variable to ensure that your Java environment has been set up properly.
3.2. Download Client Software
The Trafodion client software is available from the Trafodion Download page. There is one
Trafodion Clients
package per release listed under <version> Binaries.
The Trafodion Clients
package consists of a zipped tar file that contains the Trafodion Clients tar file.
The Trafodion Client binaries are in the clients
folder, which contains the following files:
File | Usage |
---|---|
|
Trafodion JDBC Type 4 Driver. |
|
Apache disclaimer. |
|
Apache license. |
|
Apache notice. |
|
Trafodion odb tool. |
|
Trafodion ODBC driver for Linux. |
|
Trafodion odb tool for windows. |
|
The Trafodion command interpreter |
|
[Not included in this release]1 Trafodion ODBC Driver for Windows. |
1 License issues prevent us from including the ODBC Driver for Windows in this release. Contact user@trafodion.apache.org for help obtaining the driver.
3.2.1. Windows Download
Do the following:
-
Create a download folder on the client workstation. For example,
c:\trafodion
. -
Open a Web browser and navigate to the Trafodion downloads site http://trafodion.apache.org/download.html.
-
Orient yourself to the binaries for the release you’re installing. Click on the
Trafodion Clients
link to start downloading the Trafodion clients tar file to your workstation. -
Place the
apache-trafodion-clients-*.tar.gz
file into the download folder.-
Unpack the
apache-trafodion-clients-*.tar.gz
file using an unzip program of your choice. This creates anapache-trafodion-clients-*.tar
file. -
Unpack the
apache-trafodion-clients-*.tar
file using an unzip program of your choice.
-
-
Verify content of the
clients
directory:JDBCT4.zip LICENSE NOTICE odb64_linux.tar.gz trafci.zip TRAF_ODBC_Linux_Driver_64.tar.gz
You use these files to install the different Trafodion clients.
3.2.2. Linux Download
Do the following:
-
Create a download directory on the client workstation. For example,
$HOME/trafodion
. -
Open a Web browser and navigate to the Trafodion downloads site http://trafodion.apache.org/download.html.
-
Orient yourself to the binaries for the release you’re installing. Right-click on the
Trafodion Clients
link and select Copy link address. -
Go to the download directory on the client workstation and use
wget
to download the client package using the URL you copied in step 3 above. -
Unpack the
apache-trafodion-clients-*.tar.gz
usingtar
.Example
$ mkdir $HOME/trafodion $ cd $HOME/trafodion $ wget <link to package> $ tar -xzvf apache-trafodion_clients-*.tar.gz $ cd clients $ ls LICENSE odb64_linux.tar.gz TRAF_ODBC_Linux_Driver_64.tar.gz JDBCT4.zip NOTICE trafci.zip $
You use these files to install the different Trafodion clients.
3.3. Unpack Client Software
The client packages are located on the client
subdirectory where you unpacked
the Trafodion distribution file. For example, c:\trafodion\clients
(Windows)
or $HOME/trafodion/clients
(Linux).
Unpack the client software and its dependencies you intend to use as follows.
3.3.1. Unpack JDBC-Based Client Software
File | Description | Recommended Target Directory |
---|---|---|
|
JDBC Type 4 Driver |
|
|
Command Interface |
|
Windows
Use your favorite compress/uncompress utility to unpack the file to the target directory defined in the table above.
Linux
Unpack the .zip
file using the unzip <file> -d <target-directory>
command:
$ cd $HOME/trafodion/clients
$ unzip JDBCT4.zip -d $HOME/trafodion/jdbct4
.
.
.
$ unzip trafci.zip -d $HOME/trafodion/trafci
.
.
.
$ cd ..
$ ls
apache-trafodion_clients-2.2.0.tar.gz clients jdbct4 trafci
$
Once complete, a fully-installed c:\trafodion
(Windows) or
$HOME/trafodion
directory should contain the following directories:
-
clients
: The compressed client software. -
jdbct4
: The Trafodion JDBC Type 4 driver installation directory. -
trafci
: The Trafodion Command Interpreter installation directory.
3.3.2. Unpack ODBC-Based Client Software
File | Description | Recommended Target Directory |
---|---|---|
|
Linux ODBC Driver |
|
|
Linux odb Utility |
|
Linux
Unpack the .tar.gz
file using the tar -xzvf <file> -C <target-directory>
command.
$ cd $HOME/trafodion/clients
$ mkdir $HOME/trafodion/odbc
$ tar -xzvf TRAF_ODBC_Linux_Driver_64.tar.gz -C $HOME/trafodion/odbc
.
.
.
$ mkdir $HOME/trafodion/odb
$ tar -xzvf odb64_linux.tar.gz -C $HOME/trafodion/odb
.
.
.
$ cd ..
$ ls
apache-trafodion_clients-2.2.0.tar.gz clients odb odbc
Once complete, a fully-installed c:\trafodion
(Windows) or
$HOME/trafodion
directory should contain:
-
clients
: The compressed client software. -
odb
: The Trafodion odb utility installation directory. -
odbc
: The Trafodion ODBC driver installation directory.
4. Install JDBC Type-4 Driver
4.1. Prerequisites
If you have not done so already, please ensure that you have setup your Java environment and unpackaged the Trafodion client software.
The examples in this chapter assumes that you have unpackaged the JDBC Type 4 driver installation files
to c:\trafodion\jdbct4
(Windows) or $HOME/trafodion/jdbct4
(Linux).
4.2. Validate Install Directory
The content of the jdbct4
installation directory is as follows:
Installation Folder | Files | Description |
---|---|---|
|
|
Product JAR file. |
|
|
Properties file that you can configure for your application environment. |
|
Readme file that explains how to use the common sample set. |
|
|
|
Sample source code for creating, populating, and dropping sample tables. |
|
|
Sample source code for getting metadata about the sample tables. |
|
Readme file that explains how to use this sample set. |
|
|
|
Sample code for simple or parameterized SELECT statements that are prepared. |
|
Readme file that explains how to use this sample set. |
|
|
|
Readme file that explains how to use this sample set. |
|
Sample source code for fetching rows from a result set. |
|
|
|
Readme file that explains how to use this sample set. |
|
Sample source code for fetching rows from a simple SELECT statement. |
4.3. Set Up Client Environment
4.3.1. Java Development
If you plan to write and run Java applications that use the Trafodion JDBC Type 4 Driver to connect to a Trafodion database, then set these
environment variables on the client workstation, replacing jdk-directory
with the location of your Java Development Kit and
replacing jdbc-installation-directory
with the name of the directory where you downloaded the JDBC Type 4 driver:
Environment Variable | On Windows | On Linux |
---|---|---|
|
|
|
|
|
|
|
|
|
1 Enclose the jdk-directory in quotes to ensure that Windows can find the directory correctly. You can use the set <variable>
command to verify the setting.
4.3.2. Configure Applications
Edit the t4jdbc.properties
file in the samples
folder. Refer to the README
file in the samples
folder for instructions.
Set these values for your environment:
-
catalog
: Specify a catalog that exists in the database. -
schema
: Specify a schema that exists in the database. -
user
: Specify the name of a user who will be accessing the database. -
password
: Specify the password of a user who will be accessing the database. -
url
: Specify this string:jdbc:t4jdbc://<host-name>:<port-number>/:
<host-name>
is the IP address or host name of the database platform.
<port-number>
is the location where the
Trafodion Database Connectivity Service (DCS) is running. (Default: 23400).
See the Trafodion Database Connectivity Services Reference Guide for information about how to configure the DCS port.
Example
In this example, Trafodion authentication has not been enabled. Therefore, you can use a dummy user and password. If authentication is enabled, then use your user and password information.
catalog = TRAFODION
schema = SEABASE
user = usr
password = pwd
url = jdbc:t4jdbc://trafodion.host.com:23400/:
The driver’s class name is org.trafodion.jdbc.t4.T4Driver .
|
4.4. Test Programs
You must use JDK and set up the environmental variables as documented in Java Development to build the test programs. |
The README
file in the samples
folder provide information for how you build and run sample Java programs.
You can use these programs to verify the setup of the Trafodion JDBC Type-4 driver.
See the Validate Install Directory section above for information on the different sample programs that are included with the Trafodion JDBC Type-4 driver.
Windows Example
Build and run the StatementSample test program to verify the JDBC Type-4 driver installation.
C:\trafodion\jdbct4\samples> cd StatementSample
C:\trafodion\jdbct4\samples\StatementSample> %JAVA_HOME%\bin\javac -classpath ..\..\lib\jdbcT4.jar *.java ..\common\*.java
Note: ..\common\sampleUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
C:\trafodion\jdbct4\samples\StatementSample> %JAVA_HOME%\bin\java -classpath ..\..\lib\jdbcT4.jar;..;. -Dt4jdbc.properties=..\t4jdbc.properties StatementSample
Mar 16, 2016 9:36:54 PM common.sampleUtils getPropertiesConnection
INFO: DriverManager.getConnection(url, props) passed
Inserting TimeStamp
Simple Select
Printing ResultSetMetaData ...
No. of Columns 12
Column 1 Data Type: CHAR Name: C1
Column 2 Data Type: SMALLINT Name: C2
Column 3 Data Type: INTEGER Name: C3
Column 4 Data Type: BIGINT Name: C4
Column 5 Data Type: VARCHAR Name: C5
Column 6 Data Type: NUMERIC Name: C6
Column 7 Data Type: DECIMAL Name: C7
Column 8 Data Type: DATE Name: C8
Column 9 Data Type: TIME Name: C9
Column 10 Data Type: TIMESTAMP Name: C10
Column 11 Data Type: REAL Name: C11
Column 12 Data Type: DOUBLE PRECISION Name: C12
Fetching rows...
Printing Row 1 using getString(), getObject()
Column 1 - Row1 ,Row1
Column 2 - 100,100
Column 3 - 12345678,12345678
Column 4 - 123456789012,123456789012
Column 5 - Selva,Selva
Column 6 - 100.12,100.12
Column 7 - 100.12,100.12
Column 8 - 2000-05-06,2000-05-06
Column 9 - 10:11:12,10:11:12
Column 10 - 2000-05-06 10:11:12.000000,2000-05-06 10:11:12.0
Column 11 - 100.12,100.12
Column 12 - 100.12,100.12
Printing Row 2 using getString(), getObject()
Column 1 - Row2 ,Row2
Column 2 - -100,-100
Column 3 - -12345678,-12345678
Column 4 - -123456789012,-123456789012
Column 5 - Selva,Selva
Column 6 - -100.12,-100.12
Column 7 - -100.12,-100.12
Column 8 - 2000-05-16,2000-05-16
Column 9 - 10:11:12,10:11:12
Column 10 - 2000-05-06 10:11:12.000000,2000-05-06 10:11:12.0
Column 11 - -100.12,-100.12
Column 12 - -100.12,-100.12
Printing Row 3 using getString(), getObject()
Column 1 - TimeStamp ,TimeStamp
Column 2 - -100,-100
Column 3 - -12345678,-12345678
Column 4 - -123456789012,-123456789012
Column 5 - Selva,Selva
Column 6 - -100.12,-100.12
Column 7 - -100.12,-100.12
Column 8 - 2016-03-16,2016-03-16
Column 9 - 21:37:03,21:37:03
Column 10 - 2016-03-16 21:37:03.053,2016-03-16 21:37:03.053
Column 11 - -100.12,-100.12
Column 12 - -100.12,-100.12
End of Data
C:\trafodion\jdbct4\samples\StatementSample>
Linux Example
Build and run the StatementSample test program to verify the JDBC Type-4 driver installation.
$ cd $HOME/trafodion/jdbct4/samples/StatementSample
$ $JAVA_HOME/bin/javac -classpath ../../lib/jdbcT4.jar *.java ../common/*.java
Note: ..\common\sampleUtils.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
$ $JAVA_HOME/bin/java -classpath ../../lib/jdbcT4.jar:..:. -Dt4jdbc.properties=../t4jdbc.properties StatementSample
Mar 16, 2016 9:36:54 PM common.sampleUtils getPropertiesConnection
INFO: DriverManager.getConnection(url, props) passed
Inserting TimeStamp
Simple Select
Printing ResultSetMetaData ...
No. of Columns 12
Column 1 Data Type: CHAR Name: C1
Column 2 Data Type: SMALLINT Name: C2
Column 3 Data Type: INTEGER Name: C3
Column 4 Data Type: BIGINT Name: C4
Column 5 Data Type: VARCHAR Name: C5
Column 6 Data Type: NUMERIC Name: C6
Column 7 Data Type: DECIMAL Name: C7
Column 8 Data Type: DATE Name: C8
Column 9 Data Type: TIME Name: C9
Column 10 Data Type: TIMESTAMP Name: C10
Column 11 Data Type: REAL Name: C11
Column 12 Data Type: DOUBLE PRECISION Name: C12
Fetching rows...
Printing Row 1 using getString(), getObject()
Column 1 - Row1 ,Row1
Column 2 - 100,100
Column 3 - 12345678,12345678
Column 4 - 123456789012,123456789012
Column 5 - Selva,Selva
Column 6 - 100.12,100.12
Column 7 - 100.12,100.12
Column 8 - 2000-05-06,2000-05-06
Column 9 - 10:11:12,10:11:12
Column 10 - 2000-05-06 10:11:12.000000,2000-05-06 10:11:12.0
Column 11 - 100.12,100.12
Column 12 - 100.12,100.12
Printing Row 2 using getString(), getObject()
Column 1 - Row2 ,Row2
Column 2 - -100,-100
Column 3 - -12345678,-12345678
Column 4 - -123456789012,-123456789012
Column 5 - Selva,Selva
Column 6 - -100.12,-100.12
Column 7 - -100.12,-100.12
Column 8 - 2000-05-16,2000-05-16
Column 9 - 10:11:12,10:11:12
Column 10 - 2000-05-06 10:11:12.000000,2000-05-06 10:11:12.0
Column 11 - -100.12,-100.12
Column 12 - -100.12,-100.12
Printing Row 3 using getString(), getObject()
Column 1 - TimeStamp ,TimeStamp
Column 2 - -100,-100
Column 3 - -12345678,-12345678
Column 4 - -123456789012,-123456789012
Column 5 - Selva,Selva
Column 6 - -100.12,-100.12
Column 7 - -100.12,-100.12
Column 8 - 2016-03-16,2016-03-16
Column 9 - 21:37:03,21:37:03
Column 10 - 2016-03-16 21:37:03.053,2016-03-16 21:37:03.053
Column 11 - -100.12,-100.12
Column 12 - -100.12,-100.12
End of Data
$
4.5. Uninstall JDBC Type-4 Driver
Run one of these sets of commands to remove the Trafodion JDBC Type 4 Driver:
-
On Windows:
rmdir /s /q <jdbc-installation-directory>
Example
rmdir /s /q c:\trafodion\jdbct4
-
On Linux:
rm -rf <jdbc-installation-directory>
Example
rm -rf $HOME/trafodion/jdbct4
Remember to update/remove environmental variables if you’ve created them in th Java Development. |
5. Install trafci
5.1. Prerequisites
If you have not done so already, please ensure that you have setup your Java environment, unpackaged the Trafodion client software, and installed the JDBC Type-4 Driver. .
The examples in this chapter assumes that you have unpackaged the trafci installation file
to c:\trafodion\trafci
(Windows) or $HOME/trafodion/trafci
(Linux).
5.2. Install Perl or Python
If you plan to use Perl or Python scripts with trafci, verify that you have Perl or Python installed on the client workstation. trafci supports these versions of Perl and Python:
-
Perl version 5.8.8
-
Python version 2.3.4
If you do not have Perl or Python, download it from any open-source software provider. You can perform this installation procedure anytime before or after installing trafci.
If you plan to run the sample scripts provided with trafci, verify that you have the Perl JavaServer and Jython (Java implementation of Python)
installed on your client workstation. Use the trafci Installation Wizard to automatically download and install both the Perl JavaServer and
Jython open source extensions. To download them manually, see the README
in the samples directory.
5.3. Verify Installation
Verify that c:\trafodion\trafci
(Windows) or $HOME/trafodion/trafci
(Linux) contains the following files:
-
README
-
trafciInstaller.jar
5.4. Run trafci Installer
trafciInstaller.jar
is used to install trafci.
Two modes are supported:
5.4.1. GUI Wizard Install
You must have the X Window system installed on your Linux client workstation to run the trafci Installer Wizard. If you do not, then use the Command-Line Install instructions below. <<< ==== Launch the Installer Wizard |
-
Move to the trafci install directory.
-
Windows:
c:\trafodion\trafci
-
Linux:
$HOME/trafodion/trafci
-
-
Double-click on
trafciInstaller.jar
If the trafci Installer Wizard does not start, then do the following from a command prompt:
-
Change director to the trafci install directory.
-
Windows:
cd c:\trafodion\trafci
-
Linux:
cd $HOME/trafodion/trafci
-
-
Launch the trafci Installer Wizard:
java -jar trafciInstaller.jar
Using the Installer Wizard
When you execute trafciInstaller.jar
, the Installer Wizard appears:
-
Click one of the buttons for the type of installation that you would like to perform:
-
Standard Installation to start the Installer Wizard. Guides you through installing both the core trafci components and the optional open source extensions.
-
Core Components for a quick installation of the core trafci files.
-
Optional Components if you have already installed the core trafci files but want to install only the optional open source extensions.
-
-
After you have selected the components you wish to install, browse and select the JDBC JAR file and then specify an installation directory where you will install trafci.
-
To locate the JDBC Type 4 Driver JAR file, click Browse next to the JDBC Type 4 Driver JAR File.
Navigate to the lib folder of the Trafodion JDBC driver and select the
jdbcT4.jar
file (c:\trafodion\jdbct4\lib\jdbcT4.jar
on Windows,$HOME/trafodion/jdbct4/lib/jdbcT4.jar
on Linux), and then click Select.The Installer Wizard now displays the path of the JDBC driver JAR file for JDBC Type 4 Driver JAR File.
-
To select the Trafodion Command Interface installation directory, click Browse next to the Trafodion Command Interface installation directory
Navicate to
c:\trafodion
(Windows) or$HOME/trafodion
(Linux)and click on Select.The Installer Wizard now displays the path of the installation directory for Trafodion Command Interface installation directory.
-
Click Next to review the open-source legal disclaimer.
-
If you agree to the terms and conditions, select the check box, and click Next.
The Installer Wizard dialog box shows which components are available for you to download and install.
-
Select the optional components to be downloaded and installed. Each optional component is installed if the component box is checked.
If you want to change the download URL for the extensions, click Edit URL, and this dialog box appears:
Type a new path, and click OK.
Perl and Python must be installed for the respective extensions to work. -
If you do not require a proxy server, proceed to Step 12.
-
If you require a proxy server, select Use the following proxy settings and enter the proxy server and port for downloading the open source extensions.
-
Click Detect Proxy Server(s) to try to auto-detect your proxy settings. If trafci detects one or more proxy servers, it displays them in a drop-down menu next to the Detect Proxy Server(s) button.
-
Click Install to start the installation.
-
After the core trafci files are installed, the Installation Status dialog box appears indicating how many files were extracted to the installation directory:
Click OK to continue the installation.
-
If you chose to install the optional components, the installer attempts to download and install them. The progress bar indicates the download progress of each file. In addition, an installation log provides details about the status of the download and installation of the components.
-
After all trafci files are installed, the Installer Wizard completes.
-
Click Exit.
5.4.2. Command-Line Installation Steps
-
At a command prompt, change to the directory where you extracted the contents of the distribution (.zip) file:
Windows
c:\> cd c:\trafodion\trafci c:\trafodion\trafci> dir README trafciInstaller.jar
Linux
$ cd $HOME/trafodion/trafci $ ls README trafciInstaller.jar
-
Before launching the command-line installer, see the command options below:
java -jar trafciInstaller.jar -help Usage: java -jar <installer jar> [ -help] | <-cm|-silent> [-jdbcFile <jdbc filename>] [-installDir <install dir>] ]
The
-silent
option installs the client without prompting you for options.Windows
java -jar trafciInstaller.jar -silent -jdbcFile "C:\trafodion\jdbct4\lib\jdbcT4.jar" -installDir C:\trafodion\trafci
Linux
java -jar trafciInstaller.jar -silent -jdbcFile "$HOME/jdbct4/lib/jdbcT4.jar" -installDir $HOME/trafodion/trafci
-jdbcFile and -installDir are optional parameters. If you do not specify those parameters, you will be prompted to enter them during installation.
-
Launch the command-line installer by entering this command:
java -jar trafciInstaller.jar -cm
The command-line installer starts and prompts you to enter the type of installation:
Windows
c:\> cd c:\trafodion\trafci c:\trafodion\trafci> java -jar trafciInstaller.jar -cm ******************************************************************** **** ** **** Welcome to Trafodion Command Interface Installer ** **** ** **** NOTE: The installer requires a the JDBC Type 4 ** **** Driver to be installed a on your workstation. ** ******************************************************************** Type Y for a standard installation, or N for optional components only. Standard Installation [Y]:
Linux
$ cd $HOME/trafodion/trafci $ java -jar trafciInstaller.jar -cm ******************************************************************** **** ** **** Welcome to Trafodion Command Interface Installer ** **** ** **** NOTE: The installer requires a the JDBC Type 4 ** **** Driver to be installed a on your workstation. ** ******************************************************************** Type Y for a standard installation, or N for optional components only. Standard Installation [Y]:
-
For a standard installation, type Y and press Enter.
-
To install the optional components only, type N, press Enter, and proceed to Step 7.
All items in square brackets are default values. Press Enter to accept the default value.
-
-
Enter the full directory path and file name of the JDBC driver JAR file,
jdbcT4.jar
, which is located in the JDBC driver lib directory:JDBC Type 4 Driver JAR File -------------------------------- Enter the location and file name:
-
Windows:
c:\trafodion\jdbct4\lib\jdbcT4.jar
-
Linux:
/opt/user/trafodion/lib/jdbcT4.jar
Don’t use environmental variables on Linux (such as $HOME
). Instead, specify the full path to thejdbcT4.jar
file.
-
-
Enter an existing directory where you would like to install trafci:
Trafodion Command Interface -------------------------------- Enter the installation directory:
-
Windows:
c:\trafodion\trafci
-
Linux:
/opt/user/trafodion/trafci
The installation status appears, indicating how many files are installed in the installation directory:
Extracted 18 files from the /opt/user/trafodion/trafci/trafciInstaller.jar archive into the /opt/user/trafodion/trafci directory. Core TRAFCI files installed. Do you want to install the optional components? [Y]:
Don’t use environmental variables on Linux (such as $HOME
). Instead, specify the full path to thejdbcT4.jar
file.
-
-
If you do not wish to download and install the optional components, type N at the prompt and press Enter, and your installation is complete. Otherwise, type Y, press Enter, and proceed through the remainder of the installation.
-
Type Y and press Enter if you agree to the terms. If you are doing an optional install only, you are prompted to enter a valid trafci installation directory:
Do you agree to these terms? (Y or N): Y Enter your installation directory:
-
If you do not require a proxy server, type N, press Enter, and proceed to Step 10. Otherwise, type Y, press Enter, and proceed to Step 9.
Use a proxy server? [N]:
-
When prompted to auto-detect proxy servers, type Y and press Enter to direct trafci to detect your proxy settings. If trafci finds proxy servers, it displays them. If you type N and press Enter, trafci prompts you to enter the proxy server and port:
Use a proxy server? [Y]: Y Attempt to auto-detect proxy server(s)? [Y]: N Enter the proxy server (do not include the port): myproxyserver.com Enter the proxy port: 8080
-
You are prompted to select which optional components you wish to download and install. You can also change the download URL.
Install Perl JavaServer extensions? [Y]: Y Perl JavaServer requires 3 files: Java.pm, JavaArray.pm, and JavaServer.jar http://search.cpan.org/src/METZZO/Java-4.7/[URL of the folder which contains these files [http://search.cpan.org/src/METZZO/Java-4.7/]:] Install Perl XML SAX Module? [Y]: Y Perl SAX XML Module URL (PerlSAX.pm) Install Jython, a Java implementation of Python? [Y]: Y Jython URL (jython_installer-2.2.jar)
-
The setup proceeds to download and install the optional open-source components. As each component is retrieved, dots (.) are printed to indicate the progress of the download.
Downloading Perl JavaServer [1 of 3] - Java.pm ......................... 100% Downloading Perl JavaServer [2 of 3] - JavaArray.pm1 ......................... 100% Downloading Perl JavaServer [3 of 3] - JavaServer.jar ......................... 100% Successfully added settings.pl Downloading Perl XML SAX Module [1 of 1] - PerlSAX.pm ......................... 100% Downloading Jython [1 of 1] - jython_installer-2.2.jar ......................... 100% Successfully Installed Jython. Successfully added settings.py Trafodion Command Interface Installation Complete. $
5.5. Verify Installed Software Files
After downloading and running the installer file, verify that the trafci software files are installed in the correct locations.
c:\trafodion\trafci
(Windows) or $HOME/trafodion/trafci
(Linux).
Folder | Files | Description |
---|---|---|
|
|
|
|
Windows launch file. |
|
|
Perl wrapper script. trafci-perl.pl is renamed trafci.pl. To run this script, see the Trafodion Command Interface Guide. |
|
|
Python wrapper script. trafci-python.py is renamed as trafci.py. To run this script, see the Trafodion Command Interface Guide. |
|
|
Linux launch file. |
|
|
Perl wrapper script. This script has been modified to invoke trafci.pl. This script is retained for backward compatibility. |
|
|
Python wrapper script. This script has been modified to invoke trafci.py. This script is retained for backward compatibility. |
|
|
|
Product JAR file. |
|
|
Product file. |
|
|
Product file. |
|
|
Readme file that describes how to use the sample scripts. |
|
Sample Perl program that executes DML statements and returns results in an array format. |
|
|
Sample Perl program that supports multiple sessions in one script. |
|
|
Sample SQL script. |
|
|
Sample Python file that uses Jython to execute DDL statements. |
|
|
Sample Python file that uses Jython to execute DML statements. |
|
|
Sample Perl file that lists all tables and respective row counts. The file accepts a wild-card argument on the command line. |
|
|
Sample Python file that lists all tables and respective row counts. The file accepts a wild-card argument on the command line. |
5.6. Modify PATH variable
Modify the PATH variable:
-
Windows:
c:\trafodion\trafci\bin\
-
Linux:
$HOME/trafodion/trafci/bin
See Set Up Path Variable for further instructions.
5.7. Test Launching trafci
For information about setting up and using trafci, such as choosing the look and feel of the interface or presetting launch parameters, see the Trafodion Command Interface Guide. |
5.7.1. Windows Example
On Windows, do the following:
-
Go to the directory where you installed trafci. For example,
c:\trafodion\trafci
-
Go to the
bin
directory -
Invoke the
trafci.cmd
file. -
Answer prompts.
cd "c:\trafodion\trafci\bin"
trafci.cmd
<screen is cleared>
Welcome to Apache Trafodion Command Interface
Copyright (c) 2015 Apache Software Foundation
Host Name/IP Address: trafodion.host.com:23400
User Name: usr
Password:
Connected to Trafodion
SQL> show schemas ;
SCHEMA NAMES
--------------------------------------------------------------------------------
SEABASE _MD_ _REPOS_ _LIBMGR_
SQL>
5.7.2. Linux Example
On Linux, do the following:
-
Go to the directory where you installed trafci. For example,
$HOME/trafodion/trafci
-
Go to the
bin
directory -
Invoke the
trafci.sh
file. -
Answer prompts.
$ cd $HOME/trafodion/trafci/bin
$ . ./trafci.sh -h trafodion.home.com:23400 -u usr -p pwd
Welcome to Apache Trafodion Command Interface
Copyright (c) 2015 Apache Software Foundation
Connected to Trafodion
SQL>show schemas;
SCHEMA NAMES
--------------------------------------------------------------------------------
SEABASE _MD_ _REPOS_ _LIBMGR_
SQL>
5.8. Uninstall trafci
If you used the executable JAR file, trafciInstaller.jar
, to install trafci, delete the entire
folder/directory when you installed trafci.
-
On Windows:
rmdir /s /q <trafci-installation-directory>
Example
rmdir /s /q c:\trafodion\trafci
-
On Linux:
rm -rf <jdbc-installation-directory>
Example
rm -rf $HOME/trafodion/trafci
Remember to remove the trafci reference in the PATH variable. |
6. Configure DBVisualizer
6.1. Prerequisites
If you have not done so already, please ensure that you have setup your Java environment, unpackaged the Trafodion client software, and installed the JDBC Type-4 Driver.
You also need DBVisualizer 9.x.x. See the DbVisualizer website. In addition, see DBVisualizer’s FAQ “How to” page: How do I change the Java version that DBVisualizer uses?
The examples in this chapter assumes that you have unpackaged the trafci installation file
to c:\trafodion\trafci
(Windows) or $HOME/trafodion/trafci
(Linux).
6.2. Configuration Instructions
6.2.1. Register JDBC Type-4 Driver
-
Select Tools>Driver Manager.
-
Click on the green plus sign to add a new driver.
-
Use the Open File icon and locate the Trafodion JDBC Type-4 Driver.
c:\trafodion\jdbct4\lib\jdbcT4.jar
(Windows) or$HOME/trafodion/jdbct4/lib/jdbcT4.jar
(Linux). -
Use the JDBC URL format (literary, do not replace the placeholders):
jdbc:t4jdbc://<host-name or ip-address>:23400/:
-
-
Close the dialog box to save the settings.
6.2.2. Create Database Connection
-
Select Database>Create Database Connection.
-
Click on the Driver (JDBC) field. This presents you with a drop-down list of drivers.
-
Select the driver you created in the step above. (
Trafodion
) -
Right-click the Database URL field. Select the URL format that pops up.
The field should be populated with:
jdbc:t4jdbc://<host-name or ip-address>:23400/:
-
Edit (double-click the field) the database URL to match your target host name and port number.
Example
jdbc:t4jdbc://node01.host.com:23400/:
-
Add your Database Userid.
-
Add your Database Password.
6.2.3. Disable Connection Validation Select Option
DBVisualizer 9.2 (or a later version)
Set the Physical Connection property to keep your connections alive. Follow these steps:
-
Open the database connection you created earlier if it’s not open.
-
Select the Properties tab.
-
In the left navigation tree, expand the Generic connection properties, and select Physical Connection.
-
Under Validation SQL, enter
values(current_timestamp)
and click Apply.
DBVisualizer 9.1 (or an earlier version)
Edit the DBVisualizer-Install-Dir\resources\dbvis-custom.prefs
file and
disable the ConnectionValidationSelect
option as shown below:
dbvis.generic.-ConnectionValidationSelect=disabled
6.2.4. Connect to Trafodion
-
Right click on the database connection.
-
Select Connect.
Once connected:
-
Select SQL Commander>New SQL Commander. (CTRL+T)
-
Browse the tree structure in the left pane under Connections.
-
Try a query.
7. Configure SQuirreL Client
7.1. Prerequisites
If you have not done so already, please ensure that you have setup your Java environment, unpackaged the Trafodion client software, and installed the JDBC Type-4 Driver.
You also need SQuirreL SQL Client 3.7.0 or later. See the SQuirreL SQL Client website.
7.2. Configuration Instructions
7.2.1. Register JDBC Type-4 Driver
-
Start SQuirreL SQL Client
-
Click in the rectangle box in the upper left of the window that has “Drivers” printed sideways.
-
Select the "+ New Driver. . ." under "Drivers" from the top menu.
-
In the Add Driver dialog box:
-
Enter
Trafodion
in the Name field. -
Enter
jdbc:t4jdbc://<host-name or ip-address:23400/:
in the Example URL field.The default port number is 23400. If you have configured JDBC server on Trafodion with a different port number, then you will need to change the 23400 value to match.
-
Select the Extra Class Path tab and then click the Add button.
Use the file browser to navigate to the directory where you installed the drivers and select the driver. (
jdbct4\lib\jdbcT4.jar
) -
Enter
org.trafodion.jdbc.t4.T4Driver
in the Class Name field at the bottom of the dialog box and then click on OK. -
If configured correctly, you will see a message stating "Driver class org.trafodion.jdbc.t4.T4Driver successfully registered for driver definition: Trafodion" in the text box at the bottom of the SQuirreL SQL window.
-
-
Click in the rectangle box in the upper left of the window that has "Drivers" printed sideways.
7.2.2. Connect to Trafodion
Use the Add Alias dialog box and create an alias for your Trafodion System.
-
Select the "+ New Alias. . ." under Aliases from the top menu.
-
In the Add Alias dialog box:
-
Enter
Trafodion Cluster
or however you want to identify the cluster in the Name field. -
Select Trafodion from the Driver select menu.
-
Enter <your user name> in the User Name field.
-
Enter <your password> in the Password field.
-
Click on the Properties button. In the Schema tab, select the Load all and cache all Schemas radio button.
-
Click on the OK button to close the Properties dialog and then click on the OK button to close the Add Aliases window.
-
-
You will now be presented with a dialog to connect. Click on the Connect button and then issue a query to test the connection.
8. Install Linux ODBC Driver
8.1. Installation Requirements
If you have not done so already, please ensure that you have unpackaged the Trafodion client software.
In addition, the ODBC driver for Linux requires libgcc 3.4.3
and libstd++ 6.0
.
If you are building ODBC applications, please use the preferred build platform, RedHat 6.x or CentOS 6.x.
The examples in this chapter assumes that you have unpackaged the JDBC Type for installation files
to $HOME/trafodion/odbc
.
8.2. Validate Install Directory
$HOME/trafodion/odbc/PkgTmp
should contain:
connect_test.cpp
install.sh
libicudataNv44.so.44
libicuucNv44.so.44
libtrafodbc_l64.so
libtrafodbc_l64_drvr.so
LICENSE
license.txt
MD5SUM
TRAFDSN
By default, a new version of the Trafodion ODBC driver is installed in the following directories unless you specify a different directory during installation:
-
/usr/lib64
-
/etc/odbc
The following header files are not packaged with the Trafodion ODBC driver: - sql.h - sqlext.h - sqltypes.h - sqlucode.h To install those header files, Set Up Client Environment below. |
8.3. Install/Reinstall Linux ODBC Driver
You must have root (sudo ) access to install the Trafodion ODBC Driver for Linux at the default system location.
If you don’t have such access, the install the ODBC driver to an alternate location; for example: $HOME/trafodion/odbc .
|
-
Install the product by entering these commands:
With
sudo
Accesscd $HOME/trafodion/odbc/PkgTmp sudo ./install.sh
Without
sudo
Accesscd $HOME/trafodion/odbc/PkgTmp ./install.sh
Except for the sample file, the
install.sh
script saves a copy (.SAV
) of your previous installation files if they exist. -
Accept the terms of the license agreement by entering yes.
Don’t use environmental variables when specifying alternative location. Instead, use the full path. For example, specify /opt/user/trafodion/odbc
instead of$HOME/trafodion/odbc
. -
Enter a directory for the library files, or press Enter to use the default directory (
/usr/lib64
). -
Enter a directory for the data-source template file, or press Enter to use the default directory (
/etc/odbc
). -
Enter a directory for the sample program, or press Enter to use the default directory (
/etc/odbc
). -
If you installed the library files, data-source template file, and the sample program in an alternative location, then verify the directory content:
8.3.1. Set Up Client Environment
If you selected default options during installation, ensure that:
-
The libraries are located in the
/usr/lib64
directory. -
A
TRAFDSN
file is in the/etc/odbc
directory.
If you select non-default locations during installation, ensure that the files are installed in the directories that you specified during installation:
$ cd $HOME/trafodion/odbc
$ ls
connect_test.cpp libicuuc.so libtrafodbc_drvr64.so libtrafodbc_l64.so PkgTmp
libicudata.so libicuuc.so.44 libtrafodbc_l64_drvr.so libtrafodbc_l64.so.1 TRAFDSN
libicudata.so.44 libtrafodbc64.so libtrafodbc_l64_drvr.so.1 MD5SUM
$
The driver expects the TRAFDSN
file to be present in either the default location (/etc/odbc
)
or the current working direct or (CWD
) of the application. As a best practice, copy
the TRAFDSN
file to the application directory.
Edit the TRAFDSN
file. Make changes to the Default_DataSource
section. At a minimum,
change the value for Server
to the address of the host you are connecting to.
Before
[Default_DataSource]
Description = Default Data Source
Catalog = TRAFODION
Schema = SEABASE
DataLang = 0
FetchBufferSize = SYSTEM_DEFAULT
Server = TCP:1.2.3.4:23400
SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT
SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT
SQL_QUERY_TIMEOUT = NO_TIMEOUT
After
[Default_DataSource]
Description = Default Data Source
Catalog = TRAFODION
Schema = SEABASE
DataLang = 0
FetchBufferSize = SYSTEM_DEFAULT
Server = TCP:node01.host.com:23400
SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT
SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT
SQL_QUERY_TIMEOUT = NO_TIMEOUT
If you are building ODBC applications, you need to install these header files in your build environment:
-
sql.h
-
sqlext.h
-
sqltypes.h
-
sqlucode.h
To install those header files from the latest packages, run this yum
command:
sudo yum -y install libiodbc libiodbc-devel
The yum
command automatically installs the header files in the /usr/include
and /usr/include/libiodbc
directories.
8.3.2. Enable Compression
When compression is enabled in the ODBC driver, the ODBC driver can send and receive large volumes of data quickly and efficiently to and from the Trafodion Database Connectivity Services (DCS) server over a TCP/IP network. By default, compression is disabled.
To enable compression in the ODBC driver or to change the compression setting, follow these steps:
-
If you are using the Trafodion ODBC driver manager, add
Compression = compression-level
to the
DSN
section ofTRAFDSN
file. -
If you are using a third-party driver manager, such as unixODBC, add
Compression = compression-level
to the
DSN
section of theodbc.ini
file.
The compression-level
is one of these values:
-
SYSTEM_DEFAULT
, which is the same as no compression -
no compression
-
best speed
-
best compression
-
balance
-
An integer from
0
to9
, with0
beingno compression
and9
being themaximum available compression
Example
[Default_DataSource]
Description = Default Data Source
Catalog = TRAFODION
Schema = SEABASE
DataLang = 0
FetchBufferSize = SYSTEM_DEFAULT
Server = TCP:node01.host.com:23400
SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT
SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT
SQL_QUERY_TIMEOUT = NO_TIMEOUT
Compression = Best Compression
8.4. Use Third-Party Driver Manager
For better performance, we recommend that you use at least version 2.3.x of unixODBC.
|
-
If you are using an external driver manager, then you must point to
libtrafodbc_drvr64.so
and not tolibtrafodbc64.so
. -
The driver,
libtrafodbc_l64_drvr.so
, has been verified with iODBC and unixODBC driver managers. -
These driver managers, as well as documentation, can be found at these Web sites:
-
For information on the necessary data-source configuration options, you will need to add to the respective configuration files (for example, to
odbc.ini
).
8.5. Run Sample Program (connect_test
)
The examples after each step assume that you have default installation directories. |
If you have a previous version of the Trafodion ODBC driver installed, you need to re-link your existing application to ensure that you pick up the correct version of the driver. If you are unsure of the version, check the version of your application with this command:
ldd object-file
-
Move to the directory where you installed the sample program:
cd /etc/odbc
-
Set the environment variable
LD_LIBRARY_PATH
:export LD_LIBRARY_PATH=<path-to-odbc-library-files or /usr/lib64>
Example
export LD_LIBRARY_PATH=/usr/lib64
-
In the
/etc/odbc/TRAFDSN
file, add the correct IP address to theServer
parameter for theDefault_DataSource
.Example (connecting to
node01.host.com:23400
)[Default_DataSource] Description = Default Data Source Catalog = TRAFODION Schema = SEABASE DataLang = 0 FetchBufferSize = SYSTEM_DEFAULT Server = TCP:node01.host.com:23400 SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT SQL_QUERY_TIMEOUT = NO_TIMEOUT Compression = Best Compression
-
Compile the sample program.
Default Installation
g++ -g connect_test.cpp -L/usr/lib64 -I/usr/include/odbc -ltrafodbc64 -o connect_test
Alterntiave Installation
g++ -g connect_test.cpp -L$HOME/trafodion/odbc -I/usr/include/odbc -ltrafodbc64 -o connect_test
-
Run the sample program:
./connect_test -d Default_DataSource -u username -p password
If the sample program runs successfully, you should see output similar to the following:
Using Connect String: DSN=Default_DataSource;UID=username;PWD=****;
Connect Test Passed...
8.6. Run Sample Program (basicsql
)
The Basic SQL sample program is not currently bundled with the ODBC Linux driver. To obtain the source code for this program, see
basicsql (Sample ODBC Program).
|
If you have a previous version of the Trafodion ODBC driver installed, you need to re-link your existing application to ensure that you pick up the correct version of the driver.
If you are unsure of the version, check the version of your application with this command:
ldd object-file
-
Move to the directory where you put the
basicsql.cpp
file. -
Set the environment variable
LD_LIBRARY_PATH
:export LD_LIBRARY_PATH=<path-to-odbc-driver-dlls>
-
In the
/etc/odbc/TRAFDSN
file, add the correct IP address to theServer
parameter for theDefault_DataSource
. For example:Example (connecting to
node01.host.com:23400
)[Default_DataSource] Description = Default Data Source Catalog = TRAFODION Schema = SEABASE DataLang = 0 FetchBufferSize = SYSTEM_DEFAULT Server = TCP:node01.host.com:23400 SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT SQL_QUERY_TIMEOUT = NO_TIMEOUT Compression = Best Compression
-
Compile the sample program.
Default Installation
g++ -g basicsql.cpp -L/usr/lib64 -I/usr/include/odbc -ltrafodbc64 -o basicsql
Alterntiave Installation
g++ -g basicsql.cpp -L$HOME/trafodion/odbc -I/usr/include/odbc -ltrafodbc64 -o basicsql
-
Run the sample program:
./basicsql Default_DataSource <username> <password>
If the sample program runs successfully, you should see output similar to the following:
Using Connect String: DSN=Default_DataSource;UID=user1;PWD=pwd1;
Successfully connected using SQLDriverConnect.
Drop sample table if it exists... Creating sample table TASKS...
Table TASKS created using SQLExecDirect.
Inserting data using SQLBindParameter, SQLPrepare, SQLExecute Data
Data inserted.
Fetching data using SQLExecDirect, SQLFetch, SQLGetData
Data selected: 1000 CREATE REPORTS 2014-3-22
Basic SQL ODBC Test Passed!
9. Install odb
If you have not done so already, please ensure that you have unpackaged the Trafodion client software and setup the Trafodion Linux ODBC Driver.
The examples in this chapter assumes that you have unpackaged the odb installation file
to $HOME/trafodion/odb
.
9.1. odb Requirements
odb requires:
-
pthread libraries (Generally installed by default)
-
unixODBC. See installation instructions below.
9.2. Install and Configure unixODBC
This section explains how to install and configure unixODBC
.
Refer to the unixODBC documentation for additional
configuration information.
-
Obtain the source code tar ball from http://www.unixodbc.org/ Use version 2.3.x or later.
-
Unpack the tar ball:
$ tar -xzvf unixODBC-2.3.1.tar.gz
-
Configure unixODBC installation (root access required):
$ cd unixODBC-2.3.1 $ sudo ./configure --disable-gui --enable-threads --disable-drivers
unixODBC is installed under
/usr/local
.If you don’t have root privileges or you want to install unixODBC somewhere else then
add --prefix=<installation_path>
to theconfigure
command here above.Example - Install unixODBC in Alternate Location
$ ./configure --prefix=$HOME/trafodion/unixodbc --disable-gui --enable-threads --disable-drivers
-
Compile unixODBC sources:
$ make
-
Install unixODBC:
$ make install
9.2.1. Configure unixODBC
-
Define environment variables.
-
Define data sources.
Start with the environment variables (which you can add to your profile script):
-
Set the
ODBCHOME
variable to the unixODBC installation directory (the one configured via--prefix
here above).Example
$ export ODBCHOME=$HOME/trafodion/unixodbc
-
Configure the system data sources directory (the one containing
odbc.ini
andodbcinst.ini
). Normally, theetc/
directory under$ODBCHOME
:$ export ODBCSYSINI=$ODBCHOME/etc
-
Configure the
ODBCINI
variable to the full path of theodbc.ini
file:$ export ODBCINI=$ODBCSYSINI/odbc.ini
-
Add the unixODBC lib directory to your
LD_LIBRARY_PATH
(Linux) orLIBPATH
(IBM AIX) orSHLIB_PATH
(HP/UX):$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ODBCHOME/lib
9.2.2. Configure Data Sources
odbc.ini
[ODBC]
[<DATA_SOURCE_NAME>]
Description = DSN Description
Driver = <odbcinst.ini corresponding section>
...
Other (Driver specific) parameters
...
odbcinst.ini
[<Driver name in odbc.ini>]
Description = Driver description
Driver = <ODBC driver>
FileUsage = 1
UsageCount = 1
Trafodion Example
$ cat odbc.ini
[ODBC]
[traf]
Description = traf DSN
Driver = Trafodion
Catalog = TRAFODION
Schema = QA
DataLang = 0
FetchBufferSize = SYSTEM_DEFAULT
Server = TCP:<server-name>:<port-no>
SQL_ATTR_CONNECTION_TIMEOUT = SYSTEM_DEFAULT
SQL_LOGIN_TIMEOUT = SYSTEM_DEFAULT
SQL_QUERY_TIMEOUT = NO_TIMEOUT
ServiceName = TRAFODION_DEFAULT_SERVICE
$ cat odbcinst.ini
[Trafodion]
Description = {project-name} ODBC Stand Alone Driver
Driver = /<dir-name>/conn/clients/odbc/libtrafodbc_drvr64.so
FileUsage = 1
UsageCount = 1
[ODBC]
Threading = 1
Trace = Off
Tracefile = uodbc.trc
$
The Threading
setting is defined as follows
(extracted from unixODBC sources DriverManager/handles.c
):
/*
* ...
* If compiled with thread support the DM allows four different
* thread strategies
*
* Level 0 - Only the DM internal structures are protected
* the driver is assumed to take care of it's self
*
* Level 1 - The driver is protected down to the statement level
* each statement will be protected, and the same for the connect
* level for connect functions, note that descriptors are considered
* equal to statements when it comes to thread protection.
*
* Level 2 - The driver is protected at the connection level. only
* one thread can be in a particular driver at one time
*
* Level 3 - The driver is protected at the env level, only one thing
* at a time.
*
* By default the driver open connections with a lock level of 0,
* drivers should be expected to be thread safe now.
* this can be changed by adding the line
*
* Threading = N
*
* to the driver entry in odbcinst.ini, where N is the locking level
*
*/
9.3. Verify odb Installation
$HOME/trafodion/odb
should contain the following files.
-
README
-
/bin/odb64luo
(the odb executable)
See the Trafodion odb User Guide for information how to use odb.
9.4. Uninstall odb
To uninstall odb, delete the README
and /bin/odb64luo
files from their installed location.
Example
rm -rf $HOME/trafodion/odb
10. Install Windows ODBC Driver
License issues prevent us from including the ODBC Driver for Windows in this release. Contact the Trafodion user e-mail list (user@trafodion.apache.org) for help obtaining the driver. |
If you have not done so already, please ensure that you have unpackaged the unpackaged the Trafodion client software.
The examples in this chapter assumes that you have unpackaged the installation files
to c:\trafodion\odbc
.
10.1. Installation Requirements
Item | Requirement |
---|---|
Computer |
Windows compatible PC workstation |
Memory |
Recommended minimum 32 MB |
Disk Space |
Minimum 30 MB additional free space |
Operating System |
x64 Edition of Microsoft Windows 7, Windows 8, Windows 10, or Windows Server 2008 |
Network Software |
TCP/IP |
10.2. Installation Instructions
To install the driver on your PC, you must be logged on with a user ID that has administrator privileges. |
The ODBC client installation file (c:\trafodion\odbc\TFODBC64-*.exe
) installs or links to
multiple client components:
This client component… | Does this… |
---|---|
Microsoft ODBC Driver Manager |
Manages access to ODBC drivers for applications. The driver manager loads and unloads drivers and passes calls for ODBC functions to the correct driver. |
Trafodion ODBC driver |
Implements ODBC function calls to enable an ODBC client application to access the Trafodion database. |
Microsoft ODBC Administrator |
Adds, configures, and removes ODBC data sources on client workstations. |
By default, a new version of the ODBC driver is installed in this directory and its folders unless you specify a different directory during installation:
Default Installation Directory | Client Operating System |
---|---|
C:\Program Files\Trafodion\TRAF |
ODBC version Windows 64-bit |
To install the Trafodion ODBC driver, do the following:
-
Double-click the
TFODBC64-*.exe
distribution file to start the InstallShield wizard. -
On the Welcome page, click Next.
-
Read and select the I accept the agreement radio button. Click Next.
-
On the Destination Folder page, click Install to select the default location:
C:\Program Files\Trafodion\TRAF ODBC version\
This location is the installation directory for ODBC header and help files. All other ODBC files are installed in
%SYSTEMROOT%\system32
. -
Validate the Destination and click Install.
-
The Windows ODBC driver is installed. Click Finish to exit the installation wizard.
10.3. Set Up ODBC Data Source
-
Start the Microsoft ODBC Administrator:
-
On Windows 7: Start > All Programs>Trafodion ODBC version > MS ODBC Administrator
-
On Windows 8: Start > Control Panel > System and Security > Administrative Tool > ODBC Data Sources (64-bit)
-
On Windows 10: Click the Windows icon in the menu bar. Select Control Panel. Search for Set up ODBC data sources (64-bit). Click on the found item.
-
-
In the ODBC Data Source Administrator dialog box, click Add.
-
Select TRAF ODBC version, and then click Finish to start the Create a New Trafodion ODBC Data Source wizard.
-
Enter the data source name (for example,
Default_DataSource_Schema1
) and an optional description, and click Next. -
Enter the
IP address
orhost name
for the database platform. Enter the default port number as 234001. Leave the defaults as is, and click Next. -
Enter the schema name. The default schema name is
SEABASE
. Click Next. -
Enter the translate DLL name and its option, if you have one. If not, leave it blank. Leave the localization defaults as is.
The Replacement Character replaces any character that is incompatible for translation when retrieving data. It is one character (one or two bytes long). The Replacement Character is assumed to be in the character set specified in the Client/Server Character Set Interaction. If it is not specified,
?
is used as the default.Click Finish.
-
The wizard gives you an opportunity to test the connection. Click Test Connection and click OK.
-
The server ID and schema are filled in for you. Enter a valid user name and password, and click OK.
The wizard attempts to connect to the data source and displays a message stating whether it was successful or not.
-
Click OK to save the data source, or click Cancel twice to quit the Create Data Source wizard.
1 Your specific installation may use a different port number. Check with your Trafodion administrator.
10.3.1. Enable Compression
When compression is enabled in the ODBC driver, the ODBC driver can send and receive large volumes of data quickly and efficiently to and from the Trafodion Database Connectivity Services (DCS) server over a TCP/IP network. By default, compression is disabled.
To enable compression in the ODBC driver or to change the compression setting, follow these steps:
-
Launch the MS ODBC Administrator.
-
On Windows 7: Start > All Programs > Trafodion ODBC version > MS ODBC Administrator
-
On Windows 8: Start > Control Panel > System and Security > Administrative Tools > ODBC Data Sources (64-bit)
-
On Windows 10: Right-click the Windows icon in the menu bar. Select Control Panel. Search for Set up ODBC data sources (64-bit). Click on the found item.
-
-
In the ODBC Data Source Administrator dialog box, select the User DSN tab, select the name of your data source under User Data Sources, and click Configure. If you did not create a data source, please refer to Setting Up the Client Environment.
A new dialog box appears, showing the configuration of your data source.
-
Select the Network tab, and then select one of these values for Compression:
-
SYSTEM_DEFAULT
, which is the same as no compression -
no compression
-
best speed
-
best compression
-
balance
-
An integer from 0 to 9, with 0 being no compression and 9 being the maximum available compression
-
-
Click OK to accept the change.
-
Click OK to exit the ODBC Data Source Administrator dialog box.
10.4. Run Sample Program (basicsql
)
The Basic SQL sample program is not currently bundled with the ODBC Windows driver. To obtain the source code and the build and run files for this program, please refer to ODBC Sample Program. |
To build and run the executable file, follow these steps:
-
Open a Visual Studio x64 Win64 Command Prompt. Make sure to select the x64 version of the command prompt. For example, on Windows 7, select Start>All Programs>Microsoft Visual Studio 2010>Visual Studio Tools>Visual Studio x64 Win64 Command Prompt.
-
At the command prompt, move to the directory where you put the
basicsql.cpp
and build files. -
Run build at the command prompt. You will see
basicsql.exe
created in the same directory as the source file. -
Before running the sample program, create a Trafodion data source named
Default_DataSource
on the client workstation using MS ODBC Administrator. For instructions, please refer to Set Up Client Environment. -
From the command prompt, run the sample program by entering either run or this command:
basicsql DefaultDataSource <username> <password>
If the sample program executes successfully, you should see this output:
Example
Using Connect String: DSN=Default_DataSource;UID=user1;PWD=pwd1; Successfully connected using SQLDriverConnect. Drop sample table if it exists... Creating sample table TASKS... Table TASKS created using SQLExecDirect. Inserting data using SQLBindParameter, SQLPrepare, SQLExecute Data inserted. Fetching data using SQLExecDirect, SQLFetch, SQLGetData Data selected: 1000 CREATE REPORTS 2014-3-22 Basic SQL ODBC Test Passed!
10.5. Reinstall Windows ODBC Driver
To reinstall the driver, we recommend that you fully remove your ODBC driver and then install the new version. Please refer to Uninstalling the Trafodion ODBC Driver for Windows and then Installing the Trafodion ODBC Driver for Windows.
10.6. Uninstalling Windows ODBC Driver
-
Start to remove the ODBC driver:
-
On Windows 7: Start > All Programs>Trafodion ODBC version > Remove TRAF ODBC version
-
On Windows 8: Start > Control Panel > Uninstall a program > Locate Trafodion ODBC64 version > Uninstall Trafodion ODBC64 version
-
On Windows 10: Right-click the Windows icon in the menu bar. Select Control Panel. Click on Apps and features. Locate Trafodion ODBC64 version and right-click it. Select Uninstall.
-
-
When the Windows Installer dialog box asks you if you want to uninstall this product, click Yes.
-
The Trafodion ODBC version dialog box displays the status and asks you to wait while
Windows configures Trafodion ODBC version
(that is, removes the Trafodion ODBC Driver from your Windows workstation).After this dialog box disappears, Trafodion ODBC version is no longer on your workstation.
Uninstalling the ODBC driver does not remove pre-existing data source definitions from the Windows registry. |
11. Configure Tableau Client
11.1. Prerequisite Software
Make sure that you have this software installed on your workstation:
-
Trafodion Windows ODBC Driver. See Install Windows ODBC Driver.
-
Tableau Software. See the Tableau website.
11.2. Tableau Datasource Configuration (.tdc) File
11.2.1. Create .tdc File
The Tableau Datasource Configuration (.tdc
) file is used to customize and tune ODBC connections.
You can download each sample documented herein by clicking the link provided with the
sample name. For example, click on trafodion.tdc
to download a .tdc file for Tableau 9.3 using Trafodion ODBC 2.1.You can access the complete source directory at: http://trafodion.apache.org/docs/client_install/resources/tableau/ |
The .tdc
file contains version-specific settings that you need to modify.
trafodion.tdc.template
<?xml version='1.0' encoding='utf-8' ?>
<connection-customization class='genericodbc' enabled='true' version='<tableau-version>' dbname='TRAFODION' odbc-native-protocol='yes' odbc-use-connection-pooling='yes'>
<vendor name='Trafodion' />
<driver name='<trafodion-driver-name>' />
<customizations>
<customization name='CAP_ISOLATION_LEVEL_SERIALIZABLE' value='no'/>
<customization name='CAP_ISOLATION_LEVEL_READ_UNCOMMITTED' value='yes' />
<customization name='CAP_SET_ISOLATION_LEVEL_VIA_ODBC_API' value='no' />
<customization name='CAP_CREATE_TEMP_TABLES' value='no' />
<customization name='CAP_SUPPRESS_DISCOVERY_QUERIES' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPPRESS_PREPARED_QUERY' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPPRESS_SELECT_STAR' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPPRESS_EXECUTED_QUERY' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPRESS_SQLSTATISTICS_API' value='yes' />
</customizations>
</connection-customization>
Save this file as trafodion.tdc
and change the following placeholders:
-
<tableau-version>
- Change to the version of Tableau you’re using. For example:9.3
-
<trafodion-driver-name>
- Change to the name of the Trafodion ODBC driver you’re using. For example:TRAF ODBC 2.1
Once edited, your trafodion.tdc
file should look similar to the example below.
trafodion.tdc
<?xml version='1.0' encoding='utf-8' ?>
<connection-customization class='genericodbc' enabled='true' version='9.3' dbname='TRAFODION' odbc-native-protocol='yes' odbc-use-connection-pooling='yes'>
<vendor name='Trafodion' />
<driver name='TRAF ODBC 2.1' />
<customizations>
<customization name='CAP_ISOLATION_LEVEL_SERIALIZABLE' value='no'/>
<customization name='CAP_ISOLATION_LEVEL_READ_UNCOMMITTED' value='yes' />
<customization name='CAP_SET_ISOLATION_LEVEL_VIA_ODBC_API' value='no' />
<customization name='CAP_CREATE_TEMP_TABLES' value='no' />
<customization name='CAP_SUPPRESS_DISCOVERY_QUERIES' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPPRESS_PREPARED_QUERY' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPPRESS_SELECT_STAR' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPPRESS_EXECUTED_QUERY' value='yes' />
<customization name='CAP_ODBC_METADATA_SUPRESS_SQLSTATISTICS_API' value='yes' />
</customizations>
</connection-customization>
11.2.2. Install .tdc File
Copy the trafodion.tdc
file to the C:\Users\%USERNAME%\Documents\My Tableau Repository\Datasources
folder.
Restart Tableay if it’s running to pick up the configuration change.
11.3. Connnect to Trafodion
-
Configure a ODBC data source using the MS ODBC Administrator. See Set Up ODBC Data Source.
-
Start Tableau.
-
Create a New Database Connection by selecting Other Databases (ODBC).
-
Select your data source in the DSN dropdown.
-
Enter Trafodion in the Database: field.
-
Enter your Username and Password.
-
Click OK to connect to your Trafodion database.
12. How To
12.1. Set Up Path Variable
You need to update your PATH variable for Java and the Trafodion clients. The examples below show how to add Java to your PATH variable. The process is similar for the different Trafodion clients.
You typically point the PATH variable to the bin directory, if it exists.
Otherwise, you point the PATH variable to the directory containing the client executable.
The examples below point to the Java bin directory.
|
12.1.1. Set PATH Variable on Windows
Windows 10
-
Right-click on the Windows icon on the menu bar. Select System.
-
Click on Advanced System Settings.
-
In the System Properties dialog box, click the Advanced tab.
-
Click the Environment Variables button.
-
Under System variables, select the variable named Path, and then click Edit. . .:
-
Click Browse. . .. Find the directory where you installed Java or the Trafodion client. Select the
bin
directory as applicable. -
Click OK to close the browse window. Click OK to close the edit window.
-
Verify that the updated Path appears under System variables, and click OK.
-
In the System Properties dialog box, click OK to accept the changes.
Windows 8
-
Right-click the Computer icon on your desktop, and then select Properties. The Control Panel > System and Security > System window appears.
-
In the left navigation bar, click the Advanced system settings link.
-
In the System Properties dialog box, click the Environment Variables button.
-
Under System variables, select the variable named Path, and then click Edit:
-
Place the cursor at the start of the Variable value field and enter the path of the Java or Trafodion client
bin
directory, ending with a semicolon (;):Example
"c:\Program Files (x86)\Java\jre7\bin";
Check that no space exists after the semicolon (;) in the path. If there are spaces in the directory name, delimit the entire directory path in double quotes (") before the semicolon. -
Click OK.
-
Verify that the updated Path appears under System variables, and click OK.
-
In the System Properties dialog box, click OK to accept the changes.
For a full installation, a sample PATH variable may contain:
SET PATH=%PATH%;C:\Program Files\Java\jre1.8.0_101\;C:\trafodion\trafci\bin\;
12.1.2. Set PATH Variable on Linux
-
Open the user profile (
.profile
or.bash_profile
for the Bash shell) in the$HOME
directory.cd $HOME vi .profile
-
In the user profile, set the
PATH
environment variable to include the path of the Java or Trafodion clientbin
directory.export PATH=$PATH:/usr/lib/jvm/java-1.7.0/bin
Place the path of the Java bin directory after $PATH
separated by colon (:
). -
To activate the changes, either log out and log in again or source in the user profile.
source profile
For a full installation, a sample PATH variable may contain:
export PATH=$PATH:/usr/lib/jvm/java-1.7.0/bin:/opt/user/trafodion/trafci/bin
12.1.3. Verify PATH Variable
Ensure that you can access the Java or Trafodion client from the command line.
Examples
Display the Java version.
c:\trafodion> java -version
java version "1.7.0_45" # This is the version you need to check
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) Client VM (build 24.45-b08, mixed mode, sharing)
c:\trafodion>
Display the trafci version.
c:\trafodion> trafci -version
Welcome to EsgynDB Enterprise Command Interface
Copyright (c) 2015-2016 Esgyn Corporation
JDBC Type 4 Driver Build ID : Traf_JDBC_Type4_Build_439d96b
Command Interface Build ID : TrafCI_Build_439d96b
c:\trafodion>
If you cannot display the version information, then you need to check your PATH variable settings again.