[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16168221#comment-16168221 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r139204340 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- Ok if this will be reworked as part of TRAFODION-2740, we can keep this as temp code to close the statement - although prematurely. Just make sure there is a comment in the code saying this will be removed when TRAFODION-2740 is addressed. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16163278#comment-16163278 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138406709 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- About your comment on T2, currently for this release only T4 support is done for LOBs . None of the other drivers support LOB datatype. They need to be addressed one by one. Weiqing, we need separate JIRAs for those too. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16163277#comment-16163277 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138406464 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- The multiple check extraction is not implemented yet according to Weiqing's previous comment and it should be. Otherwise the application won't be able to extract more than the first 512 MB of data.That is our extract chunk size default in SQL. But he will fix it in with a different JIRA and PR. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16163182#comment-16163182 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user selvaganesang commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138397172 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- I am assuming that the streaming concept is implemented in the JDBC/ODBC driver and the server side just fetches the data in bulk at some size, If the fetch bulk size is greater than the user requested size, it would be serviced from the driver itself or when it is lesser multiple chunks will be fetched to satisfy the user requested size. If so, this change looks ok. However, there is a drawback that this change may not be portable to JDBC T2 driver because there can be only one extract query active at a time. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16162658#comment-16162658 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user xwq commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138281163 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- For "update lob append", it can be called multi times to append large data to a single LOB. The "extract LOB", maybe I can create another PR for it. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16162506#comment-16162506 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138252548 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- This seems like a big restriction since we will allow a max of 512 MB only. This means the user cannot even havea picture file of 1 G or 2 G in this release ? How about for update lob ? Will the caller be able to use "update lob append " several times to append data to a single lob ? > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16162498#comment-16162498 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user xwq commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138251712 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- I will documented it. For the large data, they are some logic in JDBC need to be designed, I will add the code when I have the solution. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16162489#comment-16162489 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138250912 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- Ok this will not work for a large stream of data though. We cannot allocate that much in memory. Are all these limitations being documented in a JIRA ? > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16162395#comment-16162395 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user xwq commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138239370 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- For now, the lob extract all data in one query, so after this query, we can call the "zeroLength' query directly. In the further, I will support the extract the data in multiple times for large data, and then, we need JDBC change. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16161591#comment-16161591 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user sandhyasun commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1225#discussion_r138132569 --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp --- @@ -6489,6 +6506,31 @@ odbc_SQLSrvr_ExtractLob_sme_( exception_->u.SQLError.errorList._buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer; exception_->u.ParamError.ParamDesc = SQLSVC_EXCEPTION_EXECUTE_FAILED; } + +IDL_long_long zeroValue = 0; +snprintf(LobExtractQuery, sizeof(LobExtractQuery), "EXTRACT LOBTOBUFFER(LOB'%s', LOCATION %Ld, SIZE %Ld)", lobHandle, (Int64)lobDataValue, ); + +retcode = QryLobExtractSrvrStmt->ExecDirect(NULL, LobExtractQuery, EXTERNAL_STMT, TYPE_CALL, SQL_ASYNC_ENABLE_OFF, 0); + --- End diff -- So who is the caller of this with 'zero' value. It needs to be triggered by the JDBC driver. But I am not seeing any changes in the driver ? The 'zeroLength' can be passed in only when the application decides to close the resultset or the connection. It cannot be called soon after the extract statement is executed. Can you clarify ? > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16154914#comment-16154914 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user xwq closed the pull request at: https://github.com/apache/incubator-trafodion/pull/1207 > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127546#comment-16127546 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1207#discussion_r133245730 --- Diff: dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/BatchTest.java --- @@ -158,38 +182,51 @@ public void testBatchInsertPkDuplicate() throws Exception { } } int expectedRowCount = 8; +PreparedStatement insertStmt = null; +Statement selectStmt = null; -// Start to prepare and execute the batch upsert -PreparedStatement insertStmt = _conn.prepareStatement(strInsert); -for(int i=0; i < 10; ++i) { -insertStmt.setInt(1, idArray[i]); -insertStmt.setString(2, nameArray[i]); -insertStmt.addBatch(); -} - try { -statusArray = insertStmt.executeBatch(); -} catch(SQLException sqle) { -assertTrue(sqle.getMessage().toUpperCase().contains("BATCH UPDATE FAILED")); -SQLException e = null; -e = sqle.getNextException(); -do { -assertTrue(e.getMessage().contains("ERROR[8102] The operation is prevented by a unique constraint")); -} while((e = e.getNextException()) != null); +// Start to prepare and execute the batch upsert +insertStmt = _conn.prepareStatement(strInsert); +for(int i=0; i < 10; ++i) { +insertStmt.setInt(1, idArray[i]); +insertStmt.setString(2, nameArray[i]); +insertStmt.addBatch(); +} + +try { +statusArray = insertStmt.executeBatch(); +} catch(SQLException sqle) { +assertTrue(sqle.getMessage().toUpperCase().contains("BATCH UPDATE FAILED")); +SQLException e = null; +e = sqle.getNextException(); +do { +assertTrue(e.getMessage().contains("ERROR[8102] The operation is prevented by a unique constraint")); +} while((e = e.getNextException()) != null); +} + +//assertArrayEquals(expectedStatusArray, statusArray); + +int rowCount = 0; +selectStmt = _conn.createStatement(); +ResultSet rs = selectStmt.executeQuery(strSelect); +while(rs.next()) { +System.out.println("ID = " + rs.getString(1) + ", Name = " + rs.getString(2)); +assertEquals(expectedIdArray[rs.getRow()-1], rs.getInt(1)); +assertEquals(expectedNameArray[rs.getRow()-1], rs.getString(2)); +rowCount++; +} +rs.close(); } - -//assertArrayEquals(expectedStatusArray, statusArray); +finally { +if (selectStmt != null) { +selectStmt.close(); +} -int rowCount = 0; -ResultSet rs = _conn.createStatement().executeQuery(strSelect); -while(rs.next()) { -System.out.println("ID = " + rs.getString(1) + ", Name = " + rs.getString(2)); -assertEquals(expectedIdArray[rs.getRow()-1], rs.getInt(1)); -assertEquals(expectedNameArray[rs.getRow()-1], rs.getString(2)); -rowCount++; -} -rs.close(); -insertStmt.close(); +if (insertStmt != null) { --- End diff -- Apologies... I don't think I was being clear. I'm wondering if we should do something like: try { selectStmt.close(); } catch (Exception e) { // ignore it } insertStmt.close(); That is, make sure we attempt insertStmt.close() even if there was a problem doing selectStmt.close(). > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127532#comment-16127532 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user xwq commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1207#discussion_r133243961 --- Diff: dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/BatchTest.java --- @@ -158,38 +182,51 @@ public void testBatchInsertPkDuplicate() throws Exception { } } int expectedRowCount = 8; +PreparedStatement insertStmt = null; +Statement selectStmt = null; -// Start to prepare and execute the batch upsert -PreparedStatement insertStmt = _conn.prepareStatement(strInsert); -for(int i=0; i < 10; ++i) { -insertStmt.setInt(1, idArray[i]); -insertStmt.setString(2, nameArray[i]); -insertStmt.addBatch(); -} - try { -statusArray = insertStmt.executeBatch(); -} catch(SQLException sqle) { -assertTrue(sqle.getMessage().toUpperCase().contains("BATCH UPDATE FAILED")); -SQLException e = null; -e = sqle.getNextException(); -do { -assertTrue(e.getMessage().contains("ERROR[8102] The operation is prevented by a unique constraint")); -} while((e = e.getNextException()) != null); +// Start to prepare and execute the batch upsert +insertStmt = _conn.prepareStatement(strInsert); +for(int i=0; i < 10; ++i) { +insertStmt.setInt(1, idArray[i]); +insertStmt.setString(2, nameArray[i]); +insertStmt.addBatch(); +} + +try { +statusArray = insertStmt.executeBatch(); +} catch(SQLException sqle) { +assertTrue(sqle.getMessage().toUpperCase().contains("BATCH UPDATE FAILED")); +SQLException e = null; +e = sqle.getNextException(); +do { +assertTrue(e.getMessage().contains("ERROR[8102] The operation is prevented by a unique constraint")); +} while((e = e.getNextException()) != null); +} + +//assertArrayEquals(expectedStatusArray, statusArray); + +int rowCount = 0; +selectStmt = _conn.createStatement(); +ResultSet rs = selectStmt.executeQuery(strSelect); +while(rs.next()) { +System.out.println("ID = " + rs.getString(1) + ", Name = " + rs.getString(2)); +assertEquals(expectedIdArray[rs.getRow()-1], rs.getInt(1)); +assertEquals(expectedNameArray[rs.getRow()-1], rs.getString(2)); +rowCount++; +} +rs.close(); } - -//assertArrayEquals(expectedStatusArray, statusArray); +finally { +if (selectStmt != null) { +selectStmt.close(); +} -int rowCount = 0; -ResultSet rs = _conn.createStatement().executeQuery(strSelect); -while(rs.next()) { -System.out.println("ID = " + rs.getString(1) + ", Name = " + rs.getString(2)); -assertEquals(expectedIdArray[rs.getRow()-1], rs.getInt(1)); -assertEquals(expectedNameArray[rs.getRow()-1], rs.getString(2)); -rowCount++; -} -rs.close(); -insertStmt.close(); +if (insertStmt != null) { --- End diff -- For now, if the selectStmt.close() throw an exception. it seems we don't have a good solution to close it. In the real case, when connection is closed, all the statement resource will be freed. > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127489#comment-16127489 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1207#discussion_r133236368 --- Diff: dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/BatchTest.java --- @@ -158,38 +182,51 @@ public void testBatchInsertPkDuplicate() throws Exception { } } int expectedRowCount = 8; +PreparedStatement insertStmt = null; +Statement selectStmt = null; -// Start to prepare and execute the batch upsert -PreparedStatement insertStmt = _conn.prepareStatement(strInsert); -for(int i=0; i < 10; ++i) { -insertStmt.setInt(1, idArray[i]); -insertStmt.setString(2, nameArray[i]); -insertStmt.addBatch(); -} - try { -statusArray = insertStmt.executeBatch(); -} catch(SQLException sqle) { -assertTrue(sqle.getMessage().toUpperCase().contains("BATCH UPDATE FAILED")); -SQLException e = null; -e = sqle.getNextException(); -do { -assertTrue(e.getMessage().contains("ERROR[8102] The operation is prevented by a unique constraint")); -} while((e = e.getNextException()) != null); +// Start to prepare and execute the batch upsert +insertStmt = _conn.prepareStatement(strInsert); +for(int i=0; i < 10; ++i) { +insertStmt.setInt(1, idArray[i]); +insertStmt.setString(2, nameArray[i]); +insertStmt.addBatch(); +} + +try { +statusArray = insertStmt.executeBatch(); +} catch(SQLException sqle) { +assertTrue(sqle.getMessage().toUpperCase().contains("BATCH UPDATE FAILED")); +SQLException e = null; +e = sqle.getNextException(); +do { +assertTrue(e.getMessage().contains("ERROR[8102] The operation is prevented by a unique constraint")); +} while((e = e.getNextException()) != null); +} + +//assertArrayEquals(expectedStatusArray, statusArray); + +int rowCount = 0; +selectStmt = _conn.createStatement(); +ResultSet rs = selectStmt.executeQuery(strSelect); +while(rs.next()) { +System.out.println("ID = " + rs.getString(1) + ", Name = " + rs.getString(2)); +assertEquals(expectedIdArray[rs.getRow()-1], rs.getInt(1)); +assertEquals(expectedNameArray[rs.getRow()-1], rs.getString(2)); +rowCount++; +} +rs.close(); } - -//assertArrayEquals(expectedStatusArray, statusArray); +finally { +if (selectStmt != null) { +selectStmt.close(); +} -int rowCount = 0; -ResultSet rs = _conn.createStatement().executeQuery(strSelect); -while(rs.next()) { -System.out.println("ID = " + rs.getString(1) + ", Name = " + rs.getString(2)); -assertEquals(expectedIdArray[rs.getRow()-1], rs.getInt(1)); -assertEquals(expectedNameArray[rs.getRow()-1], rs.getString(2)); -rowCount++; -} -rs.close(); -insertStmt.close(); +if (insertStmt != null) { --- End diff -- Could the selectStmt.close() throw an exception, preventing us from trying to close insertStmt? > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127487#comment-16127487 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1207#discussion_r133236703 --- Diff: dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestTinyInt.java --- @@ -77,9 +77,16 @@ public void JDBCTinyIntSigned() throws SQLException { e.printStackTrace(); assertNull(e.getMessage()); } finally { -stmt.close(); -prepStmt.close(); -conn.close(); +if (stmt != null) { +stmt.close(); +} +if (prepStmt != null) { --- End diff -- Same comment as above > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127486#comment-16127486 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1207#discussion_r133236549 --- Diff: dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestBoolean.java --- @@ -75,9 +75,17 @@ public void JDBCBoolean() throws SQLException { e.printStackTrace(); assertNull(e.getMessage()); } finally { -stmt.close(); -prepStmt.close(); -conn.close(); +if (stmt != null) { +stmt.close(); +} + +if (prepStmt != null) { --- End diff -- Could the stmt.close() throw an exception, preventing us from trying to close prepStmt and conn? > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127488#comment-16127488 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user DaveBirdsall commented on a diff in the pull request: https://github.com/apache/incubator-trafodion/pull/1207#discussion_r133236737 --- Diff: dcs/src/test/jdbc_test/src/test/java/org/trafodion/jdbc_test/TestTinyInt.java --- @@ -123,9 +130,17 @@ public void JDBCTinyIntUnsigned() throws SQLException { e.printStackTrace(); assertNull(e.getMessage()); } finally { +if (stmt != null) { stmt.close(); -prepStmt.close(); -conn.close(); +} + +if (prepStmt != null) { --- End diff -- And here too > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127112#comment-16127112 ] ASF GitHub Bot commented on TRAFODION-2704: --- Github user xwq closed the pull request at: https://github.com/apache/incubator-trafodion/pull/1199 > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (TRAFODION-2704) JDBC regression test failed by too many statement on the same session
[ https://issues.apache.org/jira/browse/TRAFODION-2704?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16127111#comment-16127111 ] ASF GitHub Bot commented on TRAFODION-2704: --- GitHub user xwq opened a pull request: https://github.com/apache/incubator-trafodion/pull/1207 [TRAFODION-2704]close unused statment in JDBC regression You can merge this pull request into a Git repository by running: $ git pull https://github.com/xwq/incubator-trafodion jdbc_fail Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-trafodion/pull/1207.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1207 commit 0eeeb86e7d1339f332f51812cd91521fb14a8090 Author: Weiqing XuDate: 2017-08-15T11:45:07Z [TRAFODION-2704]close unused statment in JDBC regression > JDBC regression test failed by too many statement on the same session > - > > Key: TRAFODION-2704 > URL: https://issues.apache.org/jira/browse/TRAFODION-2704 > Project: Apache Trafodion > Issue Type: Bug >Reporter: Weiqing Xu >Assignee: Weiqing Xu > -- This message was sent by Atlassian JIRA (v6.4.14#64029)