From 862c1f2138c9da102ef0df136e4612f45a46d37d Mon Sep 17 00:00:00 2001 From: James Strachan Date: Thu, 16 Feb 2006 10:35:59 +0000 Subject: [PATCH] Applied patch from haliq for AMQ-574 git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@378218 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/activemq/store/jdbc/TransactionContext.java | 6 ++++-- .../activemq/store/jdbc/adapter/OracleJDBCAdapter.java | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java index 40b0ddc248..9f619a2fb0 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/TransactionContext.java @@ -20,6 +20,7 @@ import java.io.IOException; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.SQLException; +import java.sql.Statement; import javax.sql.DataSource; @@ -90,8 +91,9 @@ public class TransactionContext { try { int[] rc = p.executeBatch(); for (int i = 0; i < rc.length; i++) { - if ( rc[i]!= 1 ) { - throw new SQLException(message); + int code = rc[i]; + if ( code > 0 || code == Statement.SUCCESS_NO_INFO ) { + throw new SQLException(message + ". Response code: " + code); } } } finally { diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java index b6f1f5ef9b..602248f94b 100755 --- a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/OracleJDBCAdapter.java @@ -51,7 +51,7 @@ public class OracleJDBCAdapter extends DefaultJDBCAdapter { protected byte[] getBinaryData(ResultSet rs, int index) throws SQLException { // Get as a BLOB - Blob aBlob = rs.getBlob(1); + Blob aBlob = rs.getBlob(index); return aBlob.getBytes(1, (int) aBlob.length()); } }