apex-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandeepdeshmukh <...@git.apache.org>
Subject [GitHub] incubator-apex-malhar pull request: APEXMALHAR-2075 enhance jdbcin...
Date Fri, 13 May 2016 08:39:26 GMT
Github user sandeepdeshmukh commented on a diff in the pull request:

    https://github.com/apache/incubator-apex-malhar/pull/269#discussion_r63150041
  
    --- Diff: library/src/test/java/com/datatorrent/lib/db/jdbc/JdbcOperatorTest.java ---
    @@ -375,14 +411,37 @@ public void testJdbcPojoInputOperator()
         OperatorContextTestHelper.TestIdOperatorContext context = new OperatorContextTestHelper.TestIdOperatorContext(
             OPERATOR_ID, attributeMap);
     
    -    insertEventsInTable(10);
    +    try {
    +      Connection con = DriverManager.getConnection(URL);
    +      String cleanTable = "delete from " + TABLE_POJO_NAME;
    +      Statement stmt = con.createStatement();
    +      stmt.executeUpdate(cleanTable);
    +      
    +      String insert = "insert into " + TABLE_POJO_NAME + " values (?,?,?,?,?)";
    +      PreparedStatement pStmt = con.prepareStatement(insert);
    +      con.prepareStatement(insert);
    +
    +      for (int i = 0; i < 10; i++) {
    +        pStmt.setInt(1, i);
    +        pStmt.setString(2, "name");
    +        pStmt.setDate(3, new Date(2016, 1, 1));
    +        pStmt.setTime(4, new Time(2016, 1, 1));
    +        pStmt.setTimestamp(5, new Timestamp(2016, 1, 1, 0, 0, 0, 0));
    +        pStmt.executeUpdate();
    +      }
    +    } catch (SQLException e) {
    --- End diff --
    
    Resources are not released/closed properly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message