5
0
mirror of https://github.com/apache/sqoop.git synced 2025-05-10 22:13:07 +08:00

SQOOP-1009: Sqoop2: Integration: Create Teradata provider

(Jarek Jarcec Cecho via Kate Ting)
This commit is contained in:
Kate Ting 2013-06-14 03:19:31 -04:00
parent 84127409a6
commit b5665fd42e
5 changed files with 121 additions and 1 deletions

11
pom.xml
View File

@ -111,6 +111,7 @@ limitations under the License.
<jdbc.postgresql.version>9.1-901.jdbc4</jdbc.postgresql.version>
<jdbc.oracle.version>11.2.0.3</jdbc.oracle.version>
<jdbc.sqlserver.version>4.0</jdbc.sqlserver.version>
<jdbc.teradata.version>14.00.00.21</jdbc.teradata.version>
</properties>
<dependencies>
@ -375,6 +376,16 @@ limitations under the License.
<artifactId>sqljdbc4</artifactId>
<version>${jdbc.sqlserver.version}</version>
</dependency>
<dependency>
<groupId>com.teradata</groupId>
<artifactId>tdgssconfig</artifactId>
<version>${jdbc.teradata.version}</version>
</dependency>
<dependency>
<groupId>com.teradata</groupId>
<artifactId>terajdbc4</artifactId>
<version>${jdbc.teradata.version}</version>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>

View File

@ -275,6 +275,34 @@ limitations under the License.
</dependencies>
</profile>
<!--
Teradata JDBC Driver
Install: mvn install:install-file -DgroupId=com.teradata -DartifactId=tdgssconfig -Dversion=14.00.00.21 -Dpackaging=jar -Dfile=/path/to/the/jar/tdgssconfig.jar
mvn install:install-file -DgroupId=com.teradata -DartifactId=terajdbc4 -Dversion=14.00.00.21 -Dpackaging=jar -Dfile=/path/to/the/jar/terajdbc4.jar
Usage: mvn integration-test -Djdbc.teradata
-->
<profile>
<id>jdbc-teradata</id>
<activation>
<property>
<name>jdbc.teradata</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>com.teradata</groupId>
<artifactId>tdgssconfig</artifactId>
</dependency>
<dependency>
<groupId>com.teradata</groupId>
<artifactId>terajdbc4</artifactId>
</dependency>
</dependencies>
</profile>
</profiles>
</project>

View File

@ -0,0 +1,79 @@
/**
* 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.
*/
package org.apache.sqoop.test.db;
/**
* Teradata Provider that will connect to remote Teradata server.
*
* JDBC can be configured via system properties. Default value is server running
* on the same box (localhost) that is access via sqoop/sqoop credentials.
*/
public class TeradataProvider extends DatabaseProvider {
public static final String DRIVER = "com.teradata.jdbc.TeraDriver";
private static final String CONNECTION = System.getProperties().getProperty(
"sqoop.provider.teradata.jdbc",
"jdbc:teradata://localhost/test"
);
private static final String USERNAME = System.getProperties().getProperty(
"sqoop.provider.teradata.username",
"sqoop"
);
private static final String PASSWORD = System.getProperties().getProperty(
"sqoop.provider.teradata.password",
"sqoop"
);
@Override
public String getConnectionUrl() {
return CONNECTION;
}
@Override
public String getConnectionUsername() {
return USERNAME;
}
@Override
public String getConnectionPassword() {
return PASSWORD;
}
@Override
public String escapeColumnName(String columnName) {
return columnName;
}
@Override
public String escapeTableName(String tableName) {
return tableName;
}
@Override
public String escapeValueString(String value) {
return "'" + value + "'";
}
@Override
public String getJdbcDriver() {
return DRIVER;
}
}

View File

@ -96,6 +96,8 @@ public void start() throws Exception {
jar.contains("mysql") || // MySQL JDBC driver
jar.contains("postgre") || // PostgreSQL JDBC driver
jar.contains("oracle") || // Oracle driver
jar.contains("terajdbc") || // Teradata driver
jar.contains("tdgs") || // Teradata driver
jar.contains("sqljdbc") || // Microsoft SQL Server driver
jar.contains("google") // Google libraries (guava, ...)
) {

View File

@ -107,7 +107,7 @@ protected void fillOutputForm(MJob job, StorageType storage, OutputFormat output
*/
protected void createAndLoadTableCities() {
createTable("id",
"id", "int",
"id", "int not null",
"country", "varchar(50)",
"city", "varchar(50)"
);