Review Board 1.7.22


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

Review Request #9069 - Created Jan. 23, 2013 and submitted

Jarek Cecho
SQOOP-843
Reviewers
Sqoop
sqoop-sqoop2
I've extended Executor class to provide ability to set autoCommit and explicitly set it to false in export loader.
Unit tests seems to be passing and I've tested the export on real cluster.
connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java
Revision 2dba8af New Change
[20] 58 lines
[+20] [+] public ResultSet executeQuery(String sql) {
59
      throw new SqoopException(
59
      throw new SqoopException(
60
          GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0002, e);
60
          GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0002, e);
61
    }
61
    }
62
  }
62
  }
63

    
   
63

   

    
   
64
  public void setAutoCommit(boolean autoCommit) {

    
   
65
    try {

    
   
66
      connection.setAutoCommit(autoCommit);

    
   
67
    } catch (SQLException e) {

    
   
68
      throw new SqoopException(GenericJdbcConnectorError.GENERIC_JDBC_CONNECTOR_0002, e);

    
   
69
    }

    
   
70
  }

    
   
71

   
64
  public void executeUpdate(String sql) {
72
  public void executeUpdate(String sql) {
65
    try {
73
    try {
66
      Statement statement = connection.createStatement(
74
      Statement statement = connection.createStatement(
67
          ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
75
          ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
68
      statement.executeUpdate(sql);
76
      statement.executeUpdate(sql);
[+20] [20] 152 lines
connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java
Revision 31dbcea New Change
 
  1. connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExecutor.java: Loading...
  2. connector/connector-generic-jdbc/src/main/java/org/apache/sqoop/connector/jdbc/GenericJdbcExportLoader.java: Loading...