1 17 18 21 package org.quartz.impl.jdbcjobstore.oracle.weblogic; 22 23 import org.apache.commons.logging.Log; 24 import org.quartz.impl.jdbcjobstore.oracle.OracleDelegate; 25 26 import java.lang.reflect.Method ; 27 import java.sql.Blob ; 28 import java.sql.ResultSet ; 29 import java.sql.SQLException ; 30 31 39 public class WebLogicOracleDelegate extends OracleDelegate { 40 41 51 public WebLogicOracleDelegate(Log logger, String tablePrefix, 52 String instanceId) { 53 super(logger, tablePrefix, instanceId); 54 } 55 56 68 public WebLogicOracleDelegate(Log logger, String tablePrefix, 69 String instanceId, Boolean useProperties) { 70 super(logger, tablePrefix, instanceId, useProperties); 71 } 72 73 76 protected Blob writeDataToBlob(ResultSet rs, int column, byte[] data) throws SQLException { 77 Blob blob = rs.getBlob(column); 78 79 if (blob == null) { 80 throw new SQLException ("Driver's Blob representation is null!"); 81 } 82 83 if (blob instanceof weblogic.jdbc.vendor.oracle.OracleThinBlob) { 85 ((weblogic.jdbc.vendor.oracle.OracleThinBlob) blob).putBytes(1, data); 86 return blob; 87 } else if(blob.getClass().getPackage().getName().startsWith("weblogic.")) { 88 try { 90 Method m = blob.getClass().getMethod("putBytes", new Class [] {long.class, byte[].class}); 92 m.invoke(blob, new Object [] {new Long (1), data}); 93 } catch (Exception e) { 94 throw new SQLException ("Unable to find putBytes(long,byte[]) method on blob: " + e); 95 } 96 return blob; 97 } else { 98 return super.writeDataToBlob(rs, column, data); 99 } 100 } 101 } | Popular Tags |