org.apache.servicemix.jdbc.adapter
Class DefaultJDBCAdapter

java.lang.Object
  extended by org.apache.servicemix.jdbc.adapter.DefaultJDBCAdapter
All Implemented Interfaces:
JDBCAdapter
Direct Known Subclasses:
BlobJDBCAdapter, BytesJDBCAdapter, DB2JDBCAdapter, ImageBasedJDBCAdaptor, MaxDBJDBCAdapter, OracleJDBCAdapter, StreamJDBCAdapter

public class DefaultJDBCAdapter
extends Object
implements JDBCAdapter

Implements all the default JDBC operations that are used by the JDBCPersistenceAdapter.

sub-classing is encouraged to override the default implementation of methods to account for differences in JDBC Driver implementations.

The JDBCAdapter inserts and extracts BLOB data using the getBytes()/setBytes() operations.

The databases/JDBC drivers that use this adapter are:

Version:
$Revision: 1.10 $

Field Summary
protected  Statements statements
           
 
Constructor Summary
DefaultJDBCAdapter()
           
 
Method Summary
 void doCreateTables(Connection connection)
           
 void doDropTables(Connection connection)
           
 int doGetCount(Connection connection)
           
 String[] doGetIds(Connection connection)
           
 String[] doGetIds(Connection connection, int fromIndex, int toIndex)
           
 byte[] doLoadData(Connection connection, String id)
           
 byte[][] doLoadData(Connection connection, String[] ids)
           
 void doRemoveData(Connection connection, String id)
           
 void doRemoveData(Connection connection, String[] ids)
           
 void doStoreData(Connection connection, String id, byte[] data)
           
 void doUpdateData(Connection connection, String id, byte[] data)
           
protected  byte[] getBinaryData(ResultSet rs, int index)
           
 Statements getStatements()
           
protected  void setBinaryData(PreparedStatement s, int index, byte[] data)
           
 void setStatements(Statements statements)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

statements

protected Statements statements
Constructor Detail

DefaultJDBCAdapter

public DefaultJDBCAdapter()
Method Detail

setBinaryData

protected void setBinaryData(PreparedStatement s,
                             int index,
                             byte[] data)
                      throws SQLException
Throws:
SQLException

getBinaryData

protected byte[] getBinaryData(ResultSet rs,
                               int index)
                        throws SQLException
Throws:
SQLException

doCreateTables

public void doCreateTables(Connection connection)
                    throws SQLException,
                           IOException
Specified by:
doCreateTables in interface JDBCAdapter
Throws:
SQLException
IOException

doDropTables

public void doDropTables(Connection connection)
                  throws SQLException,
                         IOException
Specified by:
doDropTables in interface JDBCAdapter
Throws:
SQLException
IOException

doStoreData

public void doStoreData(Connection connection,
                        String id,
                        byte[] data)
                 throws SQLException,
                        IOException
Specified by:
doStoreData in interface JDBCAdapter
Throws:
SQLException
IOException

doLoadData

public byte[] doLoadData(Connection connection,
                         String id)
                  throws SQLException,
                         IOException
Specified by:
doLoadData in interface JDBCAdapter
Throws:
SQLException
IOException

doUpdateData

public void doUpdateData(Connection connection,
                         String id,
                         byte[] data)
                  throws SQLException,
                         IOException
Specified by:
doUpdateData in interface JDBCAdapter
Throws:
SQLException
IOException

doRemoveData

public void doRemoveData(Connection connection,
                         String id)
                  throws SQLException,
                         IOException
Specified by:
doRemoveData in interface JDBCAdapter
Throws:
SQLException
IOException

getStatements

public Statements getStatements()
Specified by:
getStatements in interface JDBCAdapter

setStatements

public void setStatements(Statements statements)
Specified by:
setStatements in interface JDBCAdapter

doLoadData

public byte[][] doLoadData(Connection connection,
                           String[] ids)
                    throws SQLException,
                           IOException
Specified by:
doLoadData in interface JDBCAdapter
Throws:
SQLException
IOException

doRemoveData

public void doRemoveData(Connection connection,
                         String[] ids)
                  throws SQLException,
                         IOException
Specified by:
doRemoveData in interface JDBCAdapter
Throws:
SQLException
IOException

doGetCount

public int doGetCount(Connection connection)
               throws SQLException,
                      IOException
Specified by:
doGetCount in interface JDBCAdapter
Throws:
SQLException
IOException

doGetIds

public String[] doGetIds(Connection connection)
                  throws SQLException,
                         IOException
Specified by:
doGetIds in interface JDBCAdapter
Throws:
SQLException
IOException

doGetIds

public String[] doGetIds(Connection connection,
                         int fromIndex,
                         int toIndex)
                  throws SQLException,
                         IOException
Specified by:
doGetIds in interface JDBCAdapter
Throws:
SQLException
IOException


Copyright © 2005-2009 Apache Software Foundation. All Rights Reserved.