From 014c62bc563c77d973fe07a0ca5d6b5a76d19971 Mon Sep 17 00:00:00 2001 From: "Hiram R. Chirino" Date: Tue, 11 Apr 2006 17:29:26 +0000 Subject: [PATCH] Better DB2 support. Thanks goes to Klaus Terjung on activemq-users list for providing the needed info. git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@393265 13f79535-47bb-0310-9956-ffa450edef68 --- .../store/jdbc/adapter/DB2JDBCAdapter.java | 40 +++++++++++++++++++ ...ibm_db2_jdbc_universal_driver_architecture | 2 +- 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DB2JDBCAdapter.java diff --git a/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DB2JDBCAdapter.java b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DB2JDBCAdapter.java new file mode 100644 index 0000000000..3b403a3768 --- /dev/null +++ b/activemq-core/src/main/java/org/apache/activemq/store/jdbc/adapter/DB2JDBCAdapter.java @@ -0,0 +1,40 @@ +/** + * + * Copyright 2005-2006 The Apache Software Foundation + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.activemq.store.jdbc.adapter; + +import java.sql.Blob; +import java.sql.ResultSet; +import java.sql.SQLException; + +/** + * + * @org.apache.xbean.XBean element="db2JDBCAdapter" + * + * @version $Revision: 1.2 $ + */ +public class DB2JDBCAdapter extends DefaultJDBCAdapter { + + public DB2JDBCAdapter() { + batchStatments=false; + } + + protected byte[] getBinaryData(ResultSet rs, int index) throws SQLException { + // Get as a BLOB + Blob aBlob = rs.getBlob(index); + return aBlob.getBytes(1, (int) aBlob.length()); + } +} diff --git a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/ibm_db2_jdbc_universal_driver_architecture b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/ibm_db2_jdbc_universal_driver_architecture index a2d8d40e92..48cde12e7d 100644 --- a/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/ibm_db2_jdbc_universal_driver_architecture +++ b/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/store/jdbc/ibm_db2_jdbc_universal_driver_architecture @@ -1 +1 @@ -class=org.apache.activemq.store.jdbc.adapter.DefaultJDBCAdapter \ No newline at end of file +class=org.apache.activemq.store.jdbc.adapter.DB2JDBCAdapter \ No newline at end of file