sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cheol...@apache.org
Subject [2/2] git commit: SQOOP-843: Generic JDBC connector is committing transaction on export with autoCommit on
Date Wed, 30 Jan 2013 23:24:41 GMT
Updated Branches:
  refs/heads/sqoop2 03408d573 -> eef227a5f


SQOOP-843: Generic JDBC connector is committing transaction on export with autoCommit on

(Jarcec Cecho via Cheolsoo Park)


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

Branch: refs/heads/sqoop2
Commit: eef227a5f9eee8a4dd04f9016387bbed59c96995
Parents: 92062d5
Author: Cheolsoo Park <cheolsoo@apache.org>
Authored: Wed Jan 30 15:23:36 2013 -0800
Committer: Cheolsoo Park <cheolsoo@apache.org>
Committed: Wed Jan 30 15:23:36 2013 -0800

----------------------------------------------------------------------
 .../sqoop/connector/jdbc/GenericJdbcExecutor.java  |    8 ++++++++
 .../connector/jdbc/GenericJdbcExportLoader.java    |    1 +
 2 files changed, 9 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/eef227a5/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java
index 2dba8af..75cf9d9 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java
@@ -61,6 +61,14 @@ public class GenericJdbcExecutor {
     }
   }
 
+  public void setAutoCommit(boolean autoCommit) {
+    try {
+      connection.setAutoCommit(autoCommit);
+    } catch (SQLException e) {
+      throw new SqoopException(GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0002, e);
+    }
+  }
+
   public void executeUpdate(String sql) {
     try {
       Statement statement = connection.createStatement(

http://git-wip-us.apache.org/repos/asf/sqoop/blob/eef227a5/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java
----------------------------------------------------------------------
diff --git a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java
b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java
index 31dbcea..5f8e129 100644
--- a/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java
+++ b/connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java
@@ -37,6 +37,7 @@ public class GenericJdbcExportLoader extends Loader<ConnectionConfiguration,
Exp
     String username = connection.connection.username;
     String password = connection.connection.password;
     GenericJdbcExecutor executor = new GenericJdbcExecutor(driver, url, username, password);
+    executor.setAutoCommit(false);
 
     String sql = context.getString(GenericJdbcConnectorConstants.CONNECTOR_JDBC_DATA_SQL);
     executor.beginBatch(sql);


Mime
View raw message