sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kathl...@apache.org
Subject git commit: SQOOP-909: Sqoop2 integration: Create Oracle and Microsoft SQL Server database providers (Jarek Jarcec Cecho via Kathleen Ting)
Date Sat, 23 Mar 2013 23:31:26 GMT
Updated Branches:
  refs/heads/sqoop2 b49b71235 -> 2237d94e6


SQOOP-909: Sqoop2 integration: Create Oracle and Microsoft SQL Server database providers
(Jarek Jarcec Cecho via Kathleen Ting)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/2237d94e
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/2237d94e
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/2237d94e

Branch: refs/heads/sqoop2
Commit: 2237d94e6669e76dc619378e189034d583f8ead5
Parents: b49b712
Author: Kate <kathleen@apache.org>
Authored: Sat Mar 23 19:25:37 2013 -0400
Committer: Kate <kathleen@apache.org>
Committed: Sat Mar 23 19:30:45 2013 -0400

----------------------------------------------------------------------
 pom.xml                                            |   12 ++
 test/pom.xml                                       |   47 ++++++++
 .../org/apache/sqoop/test/db/OracleProvider.java   |   83 +++++++++++++++
 .../apache/sqoop/test/db/SqlServerProvider.java    |   83 +++++++++++++++
 .../test/minicluster/TomcatSqoopMiniCluster.java   |    2 +
 5 files changed, 227 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/2237d94e/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0620d08..25dfba6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -108,6 +108,8 @@ limitations under the License.
     <tomcat.version>${tomcat.major.version}.${tomcat.minor.version}</tomcat.version>
     <jdbc.mysql.version>5.1.23</jdbc.mysql.version>
     <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>
   </properties>
 
   <dependencies>
@@ -362,6 +364,16 @@ limitations under the License.
         <artifactId>postgresql</artifactId>
         <version>${jdbc.postgresql.version}</version>
       </dependency>
+      <dependency>
+        <groupId>com.oracle</groupId>
+        <artifactId>ojdbc14</artifactId>
+        <version>${jdbc.oracle.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.microsoft</groupId>
+        <artifactId>sqljdbc4</artifactId>
+        <version>${jdbc.sqlserver.version}</version>
+      </dependency>
    </dependencies>
   </dependencyManagement>
 

http://git-wip-us.apache.org/repos/asf/sqoop/blob/2237d94e/test/pom.xml
----------------------------------------------------------------------
diff --git a/test/pom.xml b/test/pom.xml
index 26aa556..58f1c49 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -228,6 +228,53 @@ limitations under the License.
       </dependencies>
 
     </profile>
+
+    <!-- Special JDBC Drivers -->
+
+    <!--
+      Oracle JDBC Driver
+      Install: mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc14  -Dversion=11.2.0.3
-Dpackaging=jar -Dfile=/path/to/the/jar/ojdbc6.jar
+      Usage: mvn integration-test -Djdbc.oracle
+    -->
+    <profile>
+      <id>jdbc-oracle</id>
+
+      <activation>
+        <property>
+          <name>jdbc.oracle</name>
+        </property>
+      </activation>
+
+      <dependencies>
+        <dependency>
+          <groupId>com.oracle</groupId>
+          <artifactId>ojdbc14</artifactId>
+        </dependency>
+      </dependencies>
+    </profile>
+
+    <!--
+      Microsoft SQL Server JDBC Driver
+      Install: mvn install:install-file -DgroupId=com.microsoft -DartifactId=sqljdbc4  -Dversion=4.0
-Dpackaging=jar -Dfile=/path/to/the/jar/sqljdbc4.jar
+      Usage: mvn integration-test -Djdbc.sqlserver
+    -->
+    <profile>
+      <id>jdbc-sqlserver</id>
+
+      <activation>
+        <property>
+          <name>jdbc.sqlserver</name>
+        </property>
+      </activation>
+
+      <dependencies>
+        <dependency>
+          <groupId>com.microsoft</groupId>
+          <artifactId>sqljdbc4</artifactId>
+        </dependency>
+      </dependencies>
+    </profile>
+
   </profiles>
 
 </project>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/2237d94e/test/src/main/java/org/apache/sqoop/test/db/OracleProvider.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/db/OracleProvider.java b/test/src/main/java/org/apache/sqoop/test/db/OracleProvider.java
new file mode 100644
index 0000000..5a55c85
--- /dev/null
+++ b/test/src/main/java/org/apache/sqoop/test/db/OracleProvider.java
@@ -0,0 +1,83 @@
+/**
+ * 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;
+
+/**
+ * Oracle Provider that will connect to remote Oracle 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 OracleProvider extends DatabaseProvider {
+
+  public static final String DRIVER = "oracle.jdbc.OracleDriver";
+
+  private static final String CONNECTION = System.getProperties().getProperty(
+    "sqoop.provider.oracle.jdbc",
+    "jdbc:oracle:thin:@//localhost/xe"
+  );
+
+  private static final String USERNAME = System.getProperties().getProperty(
+    "sqoop.provider.oracle.username",
+    "sqoop"
+  );
+
+  private static final String PASSWORD = System.getProperties().getProperty(
+    "sqoop.provider.oracle.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 escape(columnName);
+  }
+
+  @Override
+  public String escapeTableName(String tableName) {
+    return escape(tableName);
+  }
+
+  @Override
+  public String escapeValueString(String value) {
+    return "'" + value + "'";
+  }
+
+  @Override
+  public String getJdbcDriver() {
+    return DRIVER;
+  }
+
+  public String escape(String entity) {
+    return "\"" + entity + "\"";
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/2237d94e/test/src/main/java/org/apache/sqoop/test/db/SqlServerProvider.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/db/SqlServerProvider.java b/test/src/main/java/org/apache/sqoop/test/db/SqlServerProvider.java
new file mode 100644
index 0000000..35b6ef3
--- /dev/null
+++ b/test/src/main/java/org/apache/sqoop/test/db/SqlServerProvider.java
@@ -0,0 +1,83 @@
+/**
+ * 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;
+
+/**
+ * Oracle Provider that will connect to remote Oracle 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 SqlServerProvider extends DatabaseProvider {
+
+  public static final String DRIVER = "com.microsoft.sqlserver.jdbc.SQLServerDriver";
+
+  private static final String CONNECTION = System.getProperties().getProperty(
+    "sqoop.provider.sqlserver.jdbc",
+    "jdbc:sqlserver://localhost"
+  );
+
+  private static final String USERNAME = System.getProperties().getProperty(
+    "sqoop.provider.sqlserver.username",
+    "sqoop"
+  );
+
+  private static final String PASSWORD = System.getProperties().getProperty(
+    "sqoop.provider.sqlserver.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 escape(columnName);
+  }
+
+  @Override
+  public String escapeTableName(String tableName) {
+    return escape(tableName);
+  }
+
+  @Override
+  public String escapeValueString(String value) {
+    return "'" + value + "'";
+  }
+
+  @Override
+  public String getJdbcDriver() {
+    return DRIVER;
+  }
+
+  public String escape(String entity) {
+    return "[" + entity + "]";
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/2237d94e/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
b/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
index 567ddbc..c7998a1 100644
--- a/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
+++ b/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
@@ -95,6 +95,8 @@ public class TomcatSqoopMiniCluster extends SqoopMiniCluster {
          jar.contains("avro-")    || // Avro
          jar.contains("mysql")    || // MySQL JDBC driver
          jar.contains("postgre")  || // PostgreSQL JDBC driver
+         jar.contains("oracle")   || // Oracle driver
+         jar.contains("sqljdbc")  || // Microsoft SQL Server driver
          jar.contains("google")      // Google libraries (guava, ...)
        ) {
         extraClassPath.add(jar);


Mime
View raw message