forked from RunningJon/xtd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.txt
executable file
·100 lines (85 loc) · 3.96 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
***********************************************************************************
** Repo is no longer maintained. **
** Use PXF instead. **
***********************************************************************************
********************************************************************************
** Author: Jon Roberts
** Date: 2013-09-17
** Application Name: XTD
** Description: eXtract TeraData data using FASTEXPORT via JDBC driver
********************************************************************************
** Support
********************************************************************************
XTD is a free application with zero support from the author or from EMC. The
application is intended to demonstrate a way to get data from TeraData to be
used with Greenplum External Web Tables.
********************************************************************************
** License
********************************************************************************
XTD is open source and licensed under the Boost Software License.
********************************************************************************
** Full Description
********************************************************************************
XTD uses TeraData's JDBC driver to connect to a TeraData instance. The
connection is done using UTF8 and with the FASTEXPORT option.
The SQL query provided is then executed resulting in a Java ResultSet. This
ResultSet is then opened and each column has some filtering done to it to
ensure proper output. The filtering includes adding an escape "\" before each
"\" and "|" character, carriage return and new line characters are replaced with
a space and lastly, NULL characters are removed.
After the data cleansing, output is created by delimiting each field with a "|"
character.
********************************************************************************
** Files Included
********************************************************************************
1. README.txt: this file
2. TD.java: Java code
3. manifest.txt
4. compile.sh
********************************************************************************
** File Created
********************************************************************************
1. XTD.jar
********************************************************************************
** Installation
********************************************************************************
1. Download TeraData JDBC drivers from here:
http://downloads.teradata.com/download/connectivity/jdbc-driver
2. Extract the two Jar files from the zip or tar.
3. Put the Jar files (tdgssconfig.jar and terajdbc4.jar) in the same directory
as the files included.
4. Execute compile.sh
5. Copy the new XTD.jar file created to /data on the MASTER server.
********************************************************************************
** Usage
********************************************************************************
XTD expects 6 parameters in this order:
1. Server name
2. Database name
3. User name
4. Password
5. SQL Query
6. FastExport
Note: use double quotes as needed and escape special characters with \.
********************************************************************************
** Java Example
********************************************************************************
Notes for example:
server (host) name is edw
database name is prod
user name is scott
password it tiger
sql is "SELECT * FROM CUSTOMER"
1 for FastExport and 0 to be disabled
java -jar /data/XTD.jar edw prod scott tiger "SELECT * FROM CUSTOMER" 1
********************************************************************************
** Greenplum Example
********************************************************************************
CREATE EXTERNAL WEB TABLE TD_CUSTOMER
(
id INT,
fname VARCHAR,
lname VARCHAR
)
EXECUTE E'java -jar /data/XTD.jar edw prod scott tiger "SELECT id, fname, lname FROM CUSTOMER" 1'
ON MASTER FORMAT 'text' (delimiter '|' null 'null' escape E'\\');