diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/.classpath b/plugins/org.eclipse.datatools.connectivity.oda.consumer/.classpath
new file mode 100644
index 0000000..751c8f2
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/.cvsignore b/plugins/org.eclipse.datatools.connectivity.oda.consumer/.cvsignore
new file mode 100644
index 0000000..16ca371
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/.cvsignore
@@ -0,0 +1,5 @@
+.settings
+bin
+doc
+download
+*.zip
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/.project b/plugins/org.eclipse.datatools.connectivity.oda.consumer/.project
new file mode 100644
index 0000000..d9eae89
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.datatools.connectivity.oda.consumer</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+	</natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/META-INF/MANIFEST.MF b/plugins/org.eclipse.datatools.connectivity.oda.consumer/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..6556af9
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/META-INF/MANIFEST.MF
@@ -0,0 +1,12 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: DTP ODA Consumer Helper Component Plug-in
+Bundle-SymbolicName: org.eclipse.datatools.connectivity.oda.consumer
+Bundle-Version: 3.0.0.200604061
+Bundle-Localization: plugin
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.datatools.connectivity.oda;visibility:=reexport
+Export-Package: org.eclipse.datatools.connectivity.oda.consumer.helper,
+ org.eclipse.datatools.connectivity.oda.consumer.nls;x-friends:="org.eclipse.datatools.connectivity.oda.consumer.tests"
+Bundle-ClassPath: odaconsumer-helper.jar
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/about.html b/plugins/org.eclipse.datatools.connectivity.oda.consumer/about.html
new file mode 100644
index 0000000..04f255c
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/about.html
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
+<HTML><HEAD><TITLE>About</TITLE>
+<META http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+</HEAD>
+<BODY lang=EN-US>
+<H2>About This Content</H2>
+<P>August 1, 2005</P>
+<H3>License</H3>
+
+The Eclipse Foundation makes available all content in this plug-in 
+("Content"). Unless otherwise indicated below, the Content is provided to you 
+under the terms and conditions of the Eclipse Public License Version 1.0 
+("EPL"). A copy of the EPL is available at <A 
+href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</A>. 
+For purposes of the EPL, "Program" will mean the Content.<P>
+
+If you did not receive this Content directly from the Eclipse Foundation, 
+the Content is being redistributed by another party ("Redistributor") and different terms and conditions may apply 
+to your use of any object code in the Content. 
+Check the Redistributor's license that was provided with the Content. 
+If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL 
+still apply to any source code in the Content. <p>
+
+</BODY></HTML>
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/build.properties b/plugins/org.eclipse.datatools.connectivity.oda.consumer/build.properties
new file mode 100644
index 0000000..ea3721b
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/build.properties
@@ -0,0 +1,33 @@
+#
+#************************************************************************
+# Copyright (c) 2004, 2006 Actuate Corporation.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#  Actuate Corporation - initial API and implementation
+#  
+#************************************************************************
+#
+plugin.jar.name = odaconsumer-helper.jar
+plugin.srczip.name = odaconsumersrc.zip
+package.odaconsumer.dir = ./org/eclipse/datatools/connectivity/oda/consumer/
+src.dir =            	 ./src/
+bin.dir =         		 ./bin/
+jar.includes =           **/*.txt,\
+                         **/*.xml,\
+                         **/*.def,\
+                         **/*.properties
+bin.includes = META-INF/,\
+               odaconsumer-helper.jar ,\
+               about.html
+javac.debug =            on
+javac.source =           1.4
+javac.target =           1.4
+build.result.dir =	 	 ./
+temp.dir =		         ./tempdir/
+plugin.destination =     ./
+javadoc.dir =            doc/api/
+download.dir =           ./download/
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/.cvsignore b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/.cvsignore
new file mode 100644
index 0000000..93bafad
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/.cvsignore
@@ -0,0 +1 @@
+vss*.scc
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaAdvancedQuery.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaAdvancedQuery.java
new file mode 100644
index 0000000..4dd275f
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaAdvancedQuery.java
@@ -0,0 +1,1711 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import org.eclipse.datatools.connectivity.oda.IAdvancedQuery;
+import org.eclipse.datatools.connectivity.oda.IBlob;
+import org.eclipse.datatools.connectivity.oda.IClob;
+import org.eclipse.datatools.connectivity.oda.IParameterRowSet;
+import org.eclipse.datatools.connectivity.oda.IResultSet;
+import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.SortSpec;
+import org.eclipse.datatools.connectivity.oda.consumer.nls.Messages;
+
+/**
+ * OdaAdvancedQuery is the ODA wrapper for advanced query statements.
+ */
+public class OdaAdvancedQuery extends OdaQuery
+							  implements IAdvancedQuery
+{
+	// flag to indicate whether executeQuery() was
+	// called from within execute().
+	private boolean m_calledExecuteQueryForExecute = false;
+
+	// used to store the result set from executeQuery() call in execute().
+	private IResultSet m_resultSet;
+
+	protected OdaAdvancedQuery( IAdvancedQuery statement, 
+								OdaConnection connection,
+								String dataSetType,
+								boolean switchContextClassloader,
+								ClassLoader driverClassLoader )
+	{
+		super( statement, connection, dataSetType,
+		       switchContextClassloader,
+			   driverClassLoader );
+		
+		String context = "OdaAdvancedQuery.OdaAdvancedQuery( " + //$NON-NLS-1$
+						 statement + ", " + connection + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+						 dataSetType + " )\t"; //$NON-NLS-1$
+		logMethodExitWithReturn( context, this );
+	}
+	
+	private IAdvancedQuery getAdvancedQuery()
+	{
+		return (IAdvancedQuery) getQuery();
+	}
+	
+	//------------------------------------------------------------------
+	//	IAdvancedQuery public interface methods
+	//------------------------------------------------------------------
+	
+	public boolean execute() throws OdaException
+	{
+		String context = "OdaAdvancedQuery.execute()\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{	
+			setContextClassloader();
+
+			doExecute();
+			logMethodExitWithReturn( context, isExecuted() );
+			return isExecuted();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IAdvancedQuery.execute()" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	private boolean doExecute() throws OdaException
+	{
+		// possibly re-executing, so need to reset the execute states
+		// from a previous execute.
+		resetExecuteStates();
+			
+		if( ! isPreparedSuccessfully() )
+			throw newOdaException( Messages.helper_cannotExecuteBeforePrepare );
+
+		boolean supportsMultipleResultSets =
+			getDSMetaData().checkSupportForMultipleResultSets();
+		boolean supportsNamedResultSets =
+			getDSMetaData().checkSupportForNamedResultSets();
+		
+		boolean isExecuted = false;
+		if( supportsMultipleResultSets || supportsNamedResultSets )
+		    isExecuted = getAdvancedQuery().execute();
+		else
+		{
+			m_resultSet = getQuery().executeQuery();
+			
+			// set both of these to be true as long as the executeQuery
+			// didn't throw an exception
+			m_calledExecuteQueryForExecute = true;
+			isExecuted = true;
+		}
+		setIsExecuted( isExecuted );
+		
+		return isExecuted;
+	}
+	
+	private boolean wasExecuteQueryCalledForExec()
+	{
+		return m_calledExecuteQueryForExecute;
+	}
+
+	protected void resetExecuteStates() 
+	{
+		super.resetExecuteStates();
+		m_calledExecuteQueryForExecute = false;
+		m_resultSet = null;
+	}
+
+	public IResultSet getResultSet() throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getResultSet()\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			OdaResultSet ret = null;
+			if( m_calledExecuteQueryForExecute )	// executeQuery was called
+			{
+				ret = ( m_resultSet == null ) ? null : newResultSetHelper( m_resultSet );
+			
+				// so subsequent calls won't return any result sets
+				m_resultSet = null;
+			}
+			else
+			{	
+				IResultSet resultSet = getAdvancedQuery().getResultSet();
+				
+				ret = ( resultSet == null ) ? null : newResultSetHelper( resultSet );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getResultSet()" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean getMoreResults() throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getMoreResults()\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			// if executeQuery was call within execute, then this should
+			// return false
+			boolean ret = ( m_calledExecuteQueryForExecute ) ? false :
+			    			getAdvancedQuery().getMoreResults();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IAdvancedQuery.getMoreResults()" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IResultSetMetaData getMetaDataOf( String resultSetName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getMetaDataOf( " +  //$NON-NLS-1$
+						 resultSetName + " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IResultSetMetaData resultSetMetaData = 
+				getAdvancedQuery().getMetaDataOf( resultSetName );
+				
+			OdaResultSetMetaData ret =
+				( resultSetMetaData == null ) ? null : 
+				new OdaResultSetMetaData( resultSetMetaData, getOdaConnection(),
+				                          switchContextClassloader(),
+										  getDriverClassLoader() );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IAdvancedQuery.getMetaDataOf( String resultSetName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String[] getResultSetNames() throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getResultSetNames()\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String[] ret = getAdvancedQuery().getResultSetNames();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getResultSetNames()" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IResultSet getResultSet( String resultSetName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getResultSet( " + //$NON-NLS-1$
+						 resultSetName + " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( wasExecuteQueryCalledForExec() )
+				throw newOdaException( Messages.helper_cannotGetNamedResultsAfterExecuteQuery );
+			
+			IResultSet resultSet = getAdvancedQuery().getResultSet( resultSetName );
+			
+			OdaResultSet ret = null;
+			
+			if( resultSet == null )
+				ret = null;
+			else
+				ret = newResultSetHelper( resultSet );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getResultSet( String resultSetName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IParameterRowSet setNewRow( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.setNewRow( " + parameterName +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			IParameterRowSet rowSet = getAdvancedQuery().setNewRow( parameterName );
+			OdaRowSet ret = createFactoryRow( rowSet );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.setNewRow( String parameterName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public IParameterRowSet setNewRow( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.setNewRow( " + parameterId +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			IParameterRowSet rowSet = getAdvancedQuery().setNewRow( parameterId );
+			OdaRowSet ret = createFactoryRow( rowSet );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.setNewRow( int parameterId )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IParameterRowSet setNewRowSet( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.setNewRowSet( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			IParameterRowSet rowSet = getAdvancedQuery().setNewRowSet( parameterName );
+			
+			OdaRowSet ret =
+				( rowSet == null ) ? null : 
+				new OdaRowSet( rowSet, getOdaConnection(),
+				               switchContextClassloader(),
+							   getDriverClassLoader() );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.setNewRowSet( String parameterName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public IParameterRowSet setNewRowSet( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.setNewRowSet( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			IParameterRowSet rowSet = getAdvancedQuery().setNewRowSet( parameterId );
+			
+			OdaRowSet ret = 
+				( rowSet == null ) ? null :
+				new OdaRowSet( rowSet, getOdaConnection(),
+				               switchContextClassloader(),
+							   getDriverClassLoader() );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.setNewRowSet( int parameterId )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getInt( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getInt( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			int ret = 0;
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getInt( parameterName );
+			else
+			{	
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getInt( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IAdvancedQuery.getInt( String parameterName )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getInt( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getInt( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )	
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			int ret = getAdvancedQuery().getInt( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IAdvancedQuery.getInt( int parameterId )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public double getDouble( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getDouble( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			double ret = 0;
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getDouble( parameterName );
+			else
+			{	
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getDouble( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IAdvancedQuery.getDouble( String parameterName )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public double getDouble( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getDouble( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			double ret = getAdvancedQuery().getDouble( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IAdvancedQuery.getDouble( int parameterId )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public BigDecimal getBigDecimal( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getBigDecimal( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			BigDecimal ret = null;
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getBigDecimal( parameterName );
+			else
+			{
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getBigDecimal( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IAdvancedQuery.getBigDecimal( String parameterName )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// we'll never get here
+		return null;
+	}
+	
+	public BigDecimal getBigDecimal( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getBigDecimal( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			BigDecimal ret = getAdvancedQuery().getBigDecimal( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IAdvancedQuery.getBigDecimal( int parameterId )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// we'll never get here
+		return null;
+	}
+
+	public String getString( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getString( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			String ret = ""; //$NON-NLS-1$
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getString( parameterName );
+			else
+			{	
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getString( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IAdvancedQuery.getString( String parameterName )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getString( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getString( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			String ret = getAdvancedQuery().getString( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IAdvancedQuery.getString( int parameterId )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Date getDate( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getDate( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			Date ret = null;
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getDate( parameterName );
+			else
+			{	
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getDate( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getDate( String parameterName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Date getDate( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getDate( " + parameterId +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )	
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			Date ret = getAdvancedQuery().getDate( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getDate( int parameterId )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Time getTime( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTime( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			Time ret = null;
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getTime( parameterName );
+			else
+			{	
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getTime( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getTime( String parameterName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Time getTime( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTime( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			Time ret = getAdvancedQuery().getTime( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getTime( int parameterId )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Timestamp getTimestamp( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTimestamp( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			Timestamp ret = null;
+			if( getDSMetaData().checkSupportForNamedParameters() )
+				ret = getAdvancedQuery().getTimestamp( parameterName );
+			else
+			{
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = getAdvancedQuery().getTimestamp( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getTimestamp( String parameterName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Timestamp getTimestamp( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTimestamp( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			Timestamp ret = getAdvancedQuery().getTimestamp( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getTimestamp( int parameterId )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getBlob(java.lang.String)
+	 */
+	public IBlob getBlob( String parameterName ) throws OdaException
+	{
+		final String context = "OdaAdvancedQuery.getBlob( " + parameterName + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
+		final String unsupportedOpContext = "IAdvancedQuery.getBlob( String parameterName )"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+		    setContextClassloader();
+		    throwIfNotExecuted();
+		    
+		    IBlob driverBlob = null;
+		    if( getDSMetaData().checkSupportForNamedParameters() )
+		        driverBlob = getAdvancedQuery().getBlob( parameterName );
+		    else
+		    {	
+		        int index = getAdvancedQuery().findOutParameter( parameterName );
+		        driverBlob = getAdvancedQuery().getBlob( index );
+		    }
+		    
+		    // instantiate helper's wrapper object
+		    IBlob ret = null;
+		    if( driverBlob != null )
+		    	ret = new OdaBlob( driverBlob, getOdaConnection(), 
+		    	        			switchContextClassloader(), 
+		    	        			getDriverClassLoader() );
+ 
+		    logMethodExitWithReturn( context, ret );
+		    return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+		    resetContextClassloader();
+		}
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getBlob(int)
+	 */
+	public IBlob getBlob( int parameterId ) throws OdaException
+	{
+		final String context = "OdaAdvancedQuery.getBlob( " + parameterId + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
+		final String unsupportedOpContext = "IAdvancedQuery.getBlob( int parameterId )"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+		    setContextClassloader();
+		    throwIfNotExecuted();
+		    
+		    IBlob driverBlob = getAdvancedQuery().getBlob( parameterId );
+		    
+		    // instantiate helper's wrapper object
+		    IBlob ret = null;	
+		    if( driverBlob != null )
+		    	ret = new OdaBlob( driverBlob, getOdaConnection(), 
+		    	        			switchContextClassloader(), 
+		    	        			getDriverClassLoader() );
+ 
+		    logMethodExitWithReturn( context, ret );
+		    return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+		    resetContextClassloader();
+		}	    
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getClob(java.lang.String)
+	 */
+	public IClob getClob( String parameterName ) throws OdaException
+	{
+		final String context = "OdaAdvancedQuery.getClob( " + parameterName + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
+		final String unsupportedOpContext = "IAdvancedQuery.getClob( String parameterName )"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+		    setContextClassloader();
+		    throwIfNotExecuted();
+		    
+		    IClob driverClob = null;
+		    if( getDSMetaData().checkSupportForNamedParameters() )
+		        driverClob = getAdvancedQuery().getClob( parameterName );
+		    else
+		    {	
+		        int index = getAdvancedQuery().findOutParameter( parameterName );
+		        driverClob = getAdvancedQuery().getClob( index );
+		    }
+		    
+		    IClob ret = null;
+		    if( driverClob != null )
+		    	ret = new OdaClob( driverClob, getOdaConnection(), 
+		    	        			switchContextClassloader(), 
+		    	        			getDriverClassLoader() );
+ 
+		    logMethodExitWithReturn( context, ret );
+		    return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+		    resetContextClassloader();
+		}	    
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getClob(int)
+	 */
+	public IClob getClob( int parameterId ) throws OdaException
+	{
+		final String context = "OdaAdvancedQuery.getClob( " + parameterId + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
+		final String unsupportedOpContext = "IAdvancedQuery.getClob( int parameterId )"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+		    setContextClassloader();
+		    throwIfNotExecuted();
+		    
+		    IClob driverClob = getAdvancedQuery().getClob( parameterId );
+		    
+		    // instantiate helper's wrapper object
+		    IClob ret = null;	
+		    if( driverClob != null )
+		    	ret = new OdaClob( driverClob, getOdaConnection(), 
+		    	        			switchContextClassloader(), 
+		    	        			getDriverClassLoader() );
+ 
+		    logMethodExitWithReturn( context, ret );
+		    return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+		    resetContextClassloader();
+		}	    
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getRow(java.lang.String)
+	 */
+	public IParameterRowSet getRow( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getRow( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			OdaRowSet ret = null;
+			
+			if( getDSMetaData().checkSupportForNamedParameters() )
+			{
+			    IParameterRowSet rowSet = getAdvancedQuery().getRow( parameterName );
+				ret = createFactoryRow( rowSet );
+			}
+			else
+			{	
+				int index = getAdvancedQuery().findOutParameter( parameterName );
+				ret = doGetRow( index );
+			}
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getRow( String parameterName )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IParameterRowSet getRow( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getRow( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+				throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+			
+			OdaRowSet ret = doGetRow( parameterId );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IAdvancedQuery.getRow( int parameterId )" ); //$NON-NLS-1$
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	private OdaRowSet doGetRow( int parameterId ) throws OdaException
+	{
+	    IParameterRowSet rowSet = getAdvancedQuery().getRow( parameterId );
+		return createFactoryRow( rowSet );
+	}
+	
+	/*
+	 * This method creates a ODA consumer manager wrapper for the underlying 
+	 * structure, and we'll move the rowset cursor to the only row 
+	 * in the structure for the caller.
+	 */
+	private OdaRowSet createFactoryRow( IParameterRowSet driverRow ) throws OdaException
+	{
+		OdaRowSet retSet = ( driverRow == null ) ? null :
+							 new OdaRowSet( driverRow, getOdaConnection(),
+							                switchContextClassloader(),
+											getDriverClassLoader() );
+		
+		// make sure that we have a structure and we could move 
+		// the cursor to the only row in the structure				 
+		return ( retSet != null && driverRow.absolute( 1 ) ) ?
+			   retSet : null;
+	}
+
+	public int findOutParameter( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.findOutParameter( " + parameterName + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )	
+				throw newOdaException( Messages.helper_cannotGetParamMdBeforePrepare );
+			
+			int ret = getAdvancedQuery().findOutParameter( parameterName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IAdvancedQuery.findOutParameter( String parameterName )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean wasNull() throws OdaException
+	{
+		String context = "OdaAdvancedQuery.wasNull()\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isExecuted() )
+			{
+				logMethodExit( context );
+				return true;
+			}
+			
+			boolean ret = getAdvancedQuery().wasNull();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IAdvancedQuery.wasNull()" ); //$NON-NLS-1$
+		}		
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setSortSpec( String resultSetName, SortSpec sortBy ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.setSortSpec( " + resultSetName + ", " + //$NON-NLS-1$ //$NON-NLS-2$
+						 sortBy + " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( 
+						Messages.helper_cannotSetSortSpecBeforePrepare );
+			
+			getAdvancedQuery().setSortSpec( resultSetName, sortBy );
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IAdvancedQuery.setSortSpec( String resultSetName, " + //$NON-NLS-1$
+											  "SortSpec sortBy )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public SortSpec getSortSpec( String resultSetName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getSortSpec( " + resultSetName + " )\t"; //$NON-NLS-1$ //$NON-NLS-2$
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			SortSpec sortSpec = getAdvancedQuery().getSortSpec( resultSetName );
+			
+			logMethodExitWithReturn( context, sortSpec );
+			return sortSpec;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IAdvancedQuery.getSortSpec( String " + //$NON-NLS-1$
+											  "resultSetName )" ); //$NON-NLS-1$
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// never gets here
+		return null;
+	}
+
+	//---------------------------------------------------------------
+	// Utility methods to encapsulate logging usage.
+	
+	public String getBigDecimalAsString( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getBigDecimalAsString( " + parameterName +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		BigDecimal decimal = getBigDecimal( parameterName );
+		String ret = ( decimal == null ) ? "" : decimal.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getBigDecimalAsString( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getBigDecimalAsString( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		BigDecimal decimal = getBigDecimal( parameterId );
+		String ret = ( decimal == null ) ? "" : decimal.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+
+	public String getDateAsString( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getDateAsString( " + parameterName +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		Date date = getDate( parameterName );
+		String ret = ( date == null ) ? "" : date.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getDateAsString( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getDateAsString( " + parameterId + //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		Date date = getDate( parameterId );
+		String ret = ( date == null ) ? "" : date.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimeAsString( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTimeAsString( " + parameterName +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		Time time = getTime( parameterName );
+		String ret = ( time == null ) ? "" : time.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimeAsString( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTimeAsString( " + parameterId +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		Time time = getTime( parameterId );
+		String ret = ( time == null ) ? "" : time.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimestampAsString( String parameterName ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTimestampAsString( " + parameterName +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		Timestamp timestamp = getTimestamp( parameterName );
+		String ret = ( timestamp == null ) ? "" : timestamp.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimestampAsString( int parameterId ) throws OdaException
+	{
+		String context = "OdaAdvancedQuery.getTimestampAsString( " + parameterId +  //$NON-NLS-1$
+						 " )\t"; //$NON-NLS-1$
+		logMethodCalled( context );
+		
+		Timestamp timestamp = getTimestamp( parameterId );
+		String ret = ( timestamp == null ) ? "" : timestamp.toString(); //$NON-NLS-1$
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getInterfaceName()
+	{
+		return IAdvancedQuery.class.getName();
+	}
+	
+	private void throwIfNotExecuted() throws OdaException
+	{
+	    if( ! isExecuted() )
+	        throw newOdaException( Messages.helper_cannotGetParamBeforeExecute );
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaBlob.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaBlob.java
new file mode 100644
index 0000000..0546edd
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaBlob.java
@@ -0,0 +1,239 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.eclipse.datatools.connectivity.oda.IBlob;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaBlob is the Oda wrapper for Blobs.
+ */
+public class OdaBlob extends OdaDriverObject implements IBlob
+{
+    
+    protected OdaBlob( IBlob blob, OdaConnection connection, 
+            boolean switchContextClassloader, ClassLoader driverClassLoader )
+    {
+        super( blob, connection, switchContextClassloader, driverClassLoader );
+        
+        String context = "OdaBlob( Blob , " + connection + " )\t";
+        logMethodCalled( context );
+    }
+
+    private IBlob getDriverBlob()
+    {
+        return (IBlob) getObject();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IBlob#getBinaryStream()
+     */
+    public InputStream getBinaryStream() throws OdaException
+    {
+        final String context = "OdaBlob.getBinaryStream()\t";
+		final String unsupportedOpContext = "IBlob.getBinaryStream()";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			InputStream ret = getDriverBlob().getBinaryStream();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IBlob#getBytes(long, int)
+     */
+    public byte[] getBytes( long position, int length ) throws OdaException
+    {
+        final String context = "OdaBlob.getBytes()\t";
+		final String unsupportedOpContext = "IBlob.getBytes()";
+		logMethodCalled( context );
+		
+		byte[] ret = null;
+		try
+		{
+			setContextClassloader();
+			
+			ret = getDriverBlob().getBytes( position, length );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+            /* underlying driver does not support short-cut method;
+             * provides default implementation to retrieve from driver's input stream
+             */
+            ret = getBytesFromStream( position, length );
+    		if( ret == null )
+            {
+                handleUnsupportedOp( uoException, unsupportedOpContext );
+                return null;
+            }
+
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IBlob#length()
+     */
+    public long length() throws OdaException
+    {
+        final String context = "OdaBlob.length()\t";
+		final String unsupportedOpContext = "IBlob.length()";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			long ret = getDriverBlob().length();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException, unsupportedOpContext );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+    
+    /**
+     * Provides default implementation to retrieve all or part of
+     * the BLOB data from the driver's input stream.
+     * Set/reset context class loader around accessing driver's object,
+     * and log caught exception.
+	 * @return			a byte array containing up to length
+	 * 					consecutive bytes from the BLOB value, 
+	 * 					starting with the byte at position;
+	 * 					or null if not able to retrieve from stream
+     * @throws OdaException
+     */
+    private byte[] getBytesFromStream( long position, int length )
+    	throws OdaException
+    {
+        final String context = "OdaBlob.getBytesFromStream()\t";
+
+        // first get the underlying driver's stream
+        InputStream driverStream = getBinaryStream();
+        
+		byte[] ret = null;
+	    try
+        {
+	        setContextClassloader();
+            ret = doGetBytesFromStream( position, length, driverStream );
+        }
+        catch( RuntimeException rte )
+        {
+			handleError( rte );		// log and throw
+        }
+        catch( IOException e )
+        {
+            log( context, e.toString() );
+        }
+		finally
+		{
+			resetContextClassloader();
+		}
+
+		return ret;		// could be null if exception was caught
+    }
+    
+    /*
+     * Provides default implementation to retrieve all or part of
+     * the BLOB data from the driver's stream.
+	 * Returns null if not able to retrieve from stream.
+     */
+    private byte[] doGetBytesFromStream( long position, int length,
+            							InputStream driverStream )
+    	throws IOException
+    {		
+        if( driverStream == null || length < 0 )
+            return null;
+        
+        // if the first byte to retrieve is after the first position in BLOB,
+        // first skip all the bytes before position
+        if( position > 1 )	
+        {
+            long numToSkip = position - 1;
+            long numSkipped = driverStream.skip( numToSkip );
+            if( numSkipped != numToSkip )
+                return null;	// not able to skip to given position
+        }
+        
+        // next, retrieve the length of bytes from stream
+        byte[] outBuffer = new byte[ length ];
+        int bytesRead = driverStream.read( outBuffer, 0, length );
+        if( bytesRead >= 0 )
+	        return outBuffer;
+        
+        return null;			// problem reading from stream
+    }
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaClob.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaClob.java
new file mode 100644
index 0000000..6e083ea
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaClob.java
@@ -0,0 +1,245 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import org.eclipse.datatools.connectivity.oda.IClob;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaClob is the Oda wrapper for Clobs.
+ */
+/**
+ *
+ */
+/**
+ *
+ */
+public class OdaClob extends OdaDriverObject implements IClob
+{
+
+    protected OdaClob( IClob clob, OdaConnection connection, boolean switchContextClassloader, ClassLoader driverClassLoader )
+    {
+        super( clob, connection, switchContextClassloader, driverClassLoader );
+        
+        String context = "OdaClob( Clob , " + connection + " )\t";
+        logMethodCalled( context );
+    }
+
+    private IClob getDriverClob()
+    {
+        return (IClob) getObject();
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IClob#getCharacterStream()
+     */
+    public Reader getCharacterStream() throws OdaException
+    {
+        final String context = "OdaClob.getCharacterStream()\t";
+		final String unsupportedOpContext = "IClob.getCharacterStream()";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Reader ret = getDriverClob().getCharacterStream();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IClob#getSubString()
+     */
+	public String getSubString( long position, int length ) 
+		throws OdaException
+	{
+        final String context = "OdaClob.getSubString()\t";
+		final String unsupportedOpContext = "IClob.getSubString()";
+		logMethodCalled( context );
+		
+		String ret = null;
+		try
+		{
+			setContextClassloader();
+			
+			ret = getDriverClob().getSubString( position, length );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+            /* underlying driver does not support short-cut method;
+             * provides default implementation to retrieve from driver's CLOB reader
+             */
+            ret = getSubStringFromReader( position, length );
+    		if( ret == null )
+            {
+                handleUnsupportedOp( uoException, unsupportedOpContext );
+                return null;
+            }
+
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IClob#length()
+     */
+    public long length() throws OdaException
+    {
+        final String context = "OdaClob.length()\t";
+		final String unsupportedOpContext = "IClob.length()";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			long ret = getDriverClob().length();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException, unsupportedOpContext );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    /**
+     * Provides default implementation to retrieve all or part of
+     * the CLOB data from the driver's reader.
+     * Set/reset context class loader around accessing driver's object,
+     * and log caught exception.
+	 * @return	the specified substring that begins at position
+	 * 			and has up to length consecutive characters;
+	 * 			or null if not able to retrieve from reader
+     * @throws OdaException
+     */
+    private String getSubStringFromReader( long position, int length ) 
+		throws OdaException
+	{
+        final String context = "OdaClob.getSubStringFromReader()\t";
+
+        // first get the underlying driver's stream
+        Reader driverReader = getCharacterStream();
+
+		String ret = null;
+	    try
+        {
+	        setContextClassloader();
+            ret = doGetSubStringFromReader( position, length, driverReader );
+        }
+        catch( RuntimeException rte )
+        {
+			handleError( rte );		// log and throw
+        }
+        catch( IOException e )
+        {
+            log( context, e.toString() );
+        }
+		finally
+		{
+			resetContextClassloader();
+		}
+
+		return ret;		// could be null if IOException was caught        
+	}
+
+    /*
+     * Provides default implementation to retrieve all or part of
+     * the CLOB data from the driver's reader.
+	 * Returns null if not able to retrieve from reader.
+     * @throws IOException
+     */
+	private String doGetSubStringFromReader( long position, int length,
+	        							 	Reader driverReader )
+    	throws IOException
+	{
+        if( driverReader == null || length < 0 )
+            return null;
+        
+        // if the first char to retrieve is beyond the first byte in BLOB,
+        // first skip all the characters before position
+        if( position > 1 )	
+        {
+            long numToSkip = position - 1;
+            long numSkipped = driverReader.skip( numToSkip );
+            if( numSkipped != numToSkip )
+                return null;	// not able to skip to given position
+        }
+        
+        // next, retrieve the length of characters from stream
+        char[] outBuffer = new char[ length ];
+        int numRead = driverReader.read( outBuffer, 0, length );
+        if( numRead >= 0 )
+	        return new String( outBuffer );
+
+        return null;			// problem reading from stream
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaConnection.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaConnection.java
new file mode 100644
index 0000000..00c4f57
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaConnection.java
@@ -0,0 +1,695 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.Properties;
+
+import org.eclipse.datatools.connectivity.oda.IAdvancedQuery;
+import org.eclipse.datatools.connectivity.oda.IConnection;
+import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
+import org.eclipse.datatools.connectivity.oda.IQuery;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.consumer.nls.Messages;
+
+/**
+ * OdaConnection is the Oda wrapper for connections.
+ */
+public class OdaConnection extends OdaObject 
+						   implements IConnection
+{	
+	private int 		m_errorNumber;
+	private String 		m_errorMessage;
+
+	// We'll use a hashtable to keep track of the count for opened 
+	// connections in each provider's classloader.
+	private static Hashtable
+						sm_clsLdrOpenedConnCountMap;
+
+	private static int	sm_maxOpenConnections = 0;	// default to no limit
+	
+	// reference count of opened statements for this connection.  this will 
+	// be used for determining whether we've reached the max statements
+	private int 		m_numOfOpenedStatements;
+	
+	// cache holding onto data set type name and its associated metadata
+	private Hashtable	m_dsMetaDataCollection;
+	
+	// holds onto the default data set type metadata ( i.e. only one data set 
+	// type in odaconfig.xml )
+	private OdaDataSetMetaData
+						m_defaultDSMetaData;
+	
+	private Locale m_locale;
+	private Object m_driverAppContext;
+	private Object m_connAppContext;
+	
+	protected OdaConnection( IConnection connection,
+	        				 boolean switchContextClassloader,
+				   			 ClassLoader driverClassLoader )
+	{
+		super( connection, switchContextClassloader, driverClassLoader );
+		
+		final String context = "OdaConnection.OdaConnection( " +
+						 connection + ")\t";
+		logMethodCalled( context );
+
+		clearDriverError();
+		m_numOfOpenedStatements = 0;
+		
+		logMethodExitWithReturn( context, this );
+	}
+	
+	static void setMaxConnections( int maxOpenConnections )
+	{
+	    sm_maxOpenConnections = maxOpenConnections;
+	}
+	
+	private Hashtable getDSMetaDataCollection()
+	{
+		if( m_dsMetaDataCollection == null )
+			m_dsMetaDataCollection = new Hashtable();
+		
+		return m_dsMetaDataCollection;
+	}
+	
+	private IConnection getConnection()
+	{
+		return (IConnection) getObject();
+	}
+
+	protected void handleError( OdaException exception ) throws OdaException
+	{
+		super.handleError( exception );
+		
+		int errorNumber = exception.getErrorCode();
+		String errorMessage = exception.toString();
+		setDriverError( errorNumber, errorMessage );
+		throw exception;
+	}
+
+	void setDriverError( int errorNumber, String errorMessage )
+	{
+		m_errorNumber = errorNumber;
+		m_errorMessage = errorMessage;
+	}
+	
+	public int getDriverErrorNumber()
+	{
+		return m_errorNumber;
+	}
+	
+	public String getDriverErrorMessage()
+	{
+		return m_errorMessage;
+	}
+	
+	public void clearDriverError()
+	{
+		m_errorNumber = 0;
+		m_errorMessage = "";
+	}
+
+	boolean canSupportMoreOpenedStatements() throws OdaException
+	{
+		int maxStatements = getMaxQueries();
+		return( maxStatements == 0 || 
+				m_numOfOpenedStatements < maxStatements );
+	}
+	
+	public int getMaxQueries() throws OdaException
+	{
+	    final String context = "OdaConnection.getMaxQueries()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getConnection().getMaxQueries();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IConnection.getMaxQueries()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnNegOne( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnNegOne( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	void addOpenStatement( OdaQuery statement )
+	{
+		// will increment the count only if the statement was prepared
+		// successfully
+		if( statement.isPreparedSuccessfully() )
+			m_numOfOpenedStatements++;
+	}
+	
+	void removeOpenStatement( OdaQuery statement )
+	{
+		// will decrement the count only if the statement was prepared
+		// successfully
+		if( statement.isPreparedSuccessfully() )
+			m_numOfOpenedStatements--;
+	}
+	
+	Locale getLocale()
+	{
+		return m_locale;
+	}
+
+	void setDriverAppContext( Object context )
+	{
+	    m_driverAppContext = context;
+	}
+	
+	private Object getDriverAppContext()
+	{
+	    return m_driverAppContext;
+	}
+	
+	//------------------------------------------------------------------
+	//	IConnection interface methods
+	//------------------------------------------------------------------
+	
+	public void open( Properties connProperties ) throws OdaException
+	{
+		final String context = "OdaConnection.open( " + connProperties +
+						 " )\t";
+		logMethodCalled( context );
+		
+		final String unsupportedOpContext = "IConnection.open( Properties connProperties )";
+
+		// pass-thru driver context to the underlying connection
+		// before attempt to call open()
+		setAppContext( getDriverAppContext() );
+		
+		try
+		{	
+			setContextClassloader();
+			
+			// check if this is already opened
+			if( checkIsOpen() )
+			{
+			    log( context, "The ODA connection is already open; skip call to the IConnection.open method." );
+				logMethodExit( context );
+				return;
+			}
+			
+			// check whether we've reached the maximum number of connections.
+			if( sm_maxOpenConnections != 0 && getOpenedConnCount() >= sm_maxOpenConnections )
+				throw newOdaException( Messages.helper_maxConcurrentConnectionsReached );
+
+			getConnection().open( connProperties );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// neither the old or new open() threw an exception, therefore the 
+		// connection was successfully opened.
+		incrOpenedConnCount();
+		logMethodExit( context );
+	}
+
+	Object getAppContext()
+	{
+	    return m_connAppContext;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IConnection#setAppContext(java.lang.Object)
+	 */
+	public void setAppContext( Object context ) throws OdaException
+	{
+		final String methodName = "OdaConnection.setAppContext()\t";
+		final String contextObjInfo = ( context == null ) ? "null" : context.toString();
+		logMethodCalled( methodName );
+
+		if( m_connAppContext == context )	// already set
+		{
+		    log( methodName, "Same pass-thru application context object: " + contextObjInfo );
+			logMethodExit( methodName );
+		    return;		// nothing to do
+		}
+
+		try
+		{
+			setContextClassloader();
+			
+		    log( methodName, "Passing thru application context to underlying ODA connection: " + contextObjInfo );
+			getConnection().setAppContext( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			// log, and ignore exception
+			logUnsupportedOp( uoException, "IConnection.setAppContext" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// if no exception with passing thru to the underlying connection,
+		// hold on to context for subsequent pass-thru to each of its
+		// queries before prepare
+		m_connAppContext = context;
+		
+		logMethodExit( methodName );
+	}
+
+	public void close() throws OdaException
+	{
+		final String context = "OdaConnection.close()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getConnection().close();
+			clearDriverError();
+			
+			m_numOfOpenedStatements = 0;
+
+			// do not clean up the connection and data source metadata
+			// cache since it's possible that this connection could be used
+			// again, due to connection re-use for some ODA connections.  Let the 
+			// garbage collection take care of it.
+			
+			// now that the connection is closed, it'll no longer count
+			// against the number of opened connections for the driver.
+			decrOpenedConnCount();
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IConnection.close()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	private int getOpenedConnCount()
+	{
+		// using new classloader scheme
+		Hashtable counts = getClsLdrOpenedConnMap();
+		Object value = counts.get( getConnection().getClass().getClassLoader() );
+		int i = ( value == null ) ? 0 : ( (Integer) value ).intValue();
+		return i;
+	}
+	
+	private void incrOpenedConnCount()
+	{
+		incrOrDecrOpenedConnectionCountMap( true /* increment */ );
+	}
+	
+	private void decrOpenedConnCount()
+	{
+		incrOrDecrOpenedConnectionCountMap( false /* increment */ );
+	}
+	
+	private void incrOrDecrOpenedConnectionCountMap( boolean increment )
+	{
+		Hashtable counts = getClsLdrOpenedConnMap();
+		ClassLoader driverClassLoader = getConnection().getClass().getClassLoader();
+		Object value = counts.get( driverClassLoader );
+		int i = ( value == null ) ? 0 : ( (Integer) value ).intValue();
+		i = ( increment ) ? ++i : --i;
+		Integer newValue = new Integer( i );
+		counts.put( driverClassLoader, newValue );
+	}
+	
+	/*
+	 * Lazily instantiate our hashtable.
+	 */
+	private Hashtable getClsLdrOpenedConnMap()
+	{
+		if( sm_clsLdrOpenedConnCountMap == null )
+			sm_clsLdrOpenedConnCountMap = new Hashtable();
+		
+		return sm_clsLdrOpenedConnCountMap;
+	}
+
+	public boolean isOpen() throws OdaException
+	{
+		final String context = "OdaConnection.isOpen()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = checkIsOpen();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IConnection.isOpen()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	private boolean checkIsOpen() throws OdaException
+	{
+		return getConnection().isOpen();
+	}
+
+	public IDataSetMetaData getMetaData( String dataSetType )
+		throws OdaException
+	{
+		final String context = "OdaConnection.getMetaData( " + dataSetType +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+
+			OdaDataSetMetaData odaDSMetaData = doGetMetaData( dataSetType );
+			if( odaDSMetaData == null )
+			    throw new UnsupportedOperationException();
+			
+			logMethodExitWithReturn( context, odaDSMetaData );
+			return odaDSMetaData;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IConnection.getMetaData( String dataSetType )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	OdaDataSetMetaData doGetMetaData( String dataSetType ) throws OdaException
+	{
+		if( dataSetType == null )
+		{
+			if( m_defaultDSMetaData != null )
+				return m_defaultDSMetaData;
+		}
+		else
+		{
+			// see if the metadata is already cached
+			if( getDSMetaDataCollection().containsKey( dataSetType ) )
+			{	
+				OdaDataSetMetaData ret = 
+					(OdaDataSetMetaData) getDSMetaDataCollection().get( dataSetType );
+				
+				return ret;
+			}
+		}
+		
+		IDataSetMetaData metadata = getConnection().getMetaData( dataSetType );
+		
+		if( metadata == null )
+			return null;
+			
+		// create new ds metadata, add it to the cache
+		OdaDataSetMetaData odaDSMetaData = new OdaDataSetMetaData( metadata, this,
+		                                                           switchContextClassloader(),
+																   getDriverClassLoader() );
+		
+		// check whether we're saving the default data set metadata or caching 
+		// it based on the data set name
+		if( dataSetType == null )
+			m_defaultDSMetaData = odaDSMetaData;
+		else
+			getDSMetaDataCollection().put( dataSetType, odaDSMetaData );
+		
+		return odaDSMetaData;
+	}
+
+	public IQuery newQuery( String dataSetType )
+		throws OdaException
+	{
+		final String context = "OdaConnection.newQuery( " +
+						 dataSetType + " )\t";
+		logMethodCalled( context );
+		final String unsupportedOpContext = "IConnection.newQuery( String dataSetType )";
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! canSupportMoreOpenedStatements() )
+			{
+				logMethodExitWithReturn( context, false );
+				throw newOdaException( Messages.helper_maxConcurrentStatementsReached );
+			}
+			
+			IQuery statement = getConnection().newQuery( dataSetType );
+			
+			if( statement == null )
+			{	
+				logMethodExit( context );
+				throw new UnsupportedOperationException();
+			}
+			
+			// IAdvancedQuery will use a different wrapper than IQuery objects.
+			IQuery ret = ( statement instanceof IAdvancedQuery ) ?
+			        		 newAdvancedQueryHelper( (IAdvancedQuery) statement, dataSetType ) :
+				   			 newQueryHelper( statement, dataSetType );
+
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	protected OdaQuery newQueryHelper( IQuery statement, String dataSetType )
+	{
+		return new OdaQuery( statement, this, dataSetType,
+	   			                 switchContextClassloader(),
+								 getDriverClassLoader() );
+	}
+	
+	protected OdaAdvancedQuery newAdvancedQueryHelper( IAdvancedQuery advancedQuery, 
+												  String dataSetType )
+	{
+		return new OdaAdvancedQuery( advancedQuery, this, dataSetType,
+   						   			 switchContextClassloader(),
+									 getDriverClassLoader() );
+	}
+
+	public void commit() throws OdaException
+	{
+	    final String context = "OdaConnection.commit()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getConnection().commit();
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IConnection.commit()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void rollback() throws OdaException
+	{
+	    final String context = "OdaConnection.rollback()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getConnection().rollback();
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IConnection.rollback()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public void setLocale( String localeString ) throws Throwable
+	{	
+	    final String context = "OdaConnection.setLocale( " +
+						 localeString + " )\t";
+		logMethodCalled( context );
+		
+		if( localeString == null || localeString.length( ) != 5 )
+			m_locale = Locale.getDefault( );
+		else
+		{
+			String language = localeString.substring( 0, 2 );
+			String country  = localeString.substring( 3, 5 );
+			m_locale = new Locale( language, country );
+		}
+		
+		try
+		{
+			Class[] parameterTypes = new Class[1];
+			parameterTypes[0] = m_locale.getClass();
+			Object[] arguments = new Object[1];
+			arguments[0] = m_locale;
+			findAndInvokeMethod( "setLocale", parameterTypes, arguments );
+		}
+		catch( InvocationTargetException ex )
+		{
+			Throwable cause = ex.getTargetException();
+			
+			if( cause instanceof RuntimeException )
+			{
+				handleError( (RuntimeException) cause );
+				return;
+			}
+			
+			if( cause instanceof OdaException )
+			{
+				handleError( (OdaException) cause );
+				return;
+			}
+			
+			throw cause;
+		}
+		catch( NoSuchMethodException ex )
+		{
+			// ignore, the underlying connection doesn't support this
+		}
+		catch( IllegalAccessException ex )
+		{
+			// ignore, the underlying connection doesn't support this
+		}
+		
+		logMethodExit( context );
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDataSetMetaData.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDataSetMetaData.java
new file mode 100644
index 0000000..305df84
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDataSetMetaData.java
@@ -0,0 +1,512 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import org.eclipse.datatools.connectivity.oda.IConnection;
+import org.eclipse.datatools.connectivity.oda.IDataSetMetaData;
+import org.eclipse.datatools.connectivity.oda.IResultSet;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaDataSetMetaData is the Oda wrapper for data set metadata.
+ */
+public class OdaDataSetMetaData extends OdaDriverObject 
+								implements IDataSetMetaData
+{
+	protected OdaDataSetMetaData( IDataSetMetaData metadata, 
+							  	  OdaConnection connection, 
+							  	  boolean switchContextClassloader,
+								  ClassLoader driverClassLoader )
+	{
+		super( metadata, connection, switchContextClassloader,
+			   driverClassLoader );
+		
+		String context = "OdaDataSetMetaData.OdaDataSetMetaData( " +
+						 metadata + ", " + connection + " )\t";
+		logMethodExitWithReturn( context, this );
+	}
+	
+	private IDataSetMetaData getDataSetMetaData()
+	{
+		return (IDataSetMetaData) getObject();
+	}
+
+	//------------------------------------------------------------------
+	//	IDataSetMetaData public interface methods
+	//------------------------------------------------------------------
+
+	public IConnection getConnection() throws OdaException
+	{
+		try
+		{
+			setContextClassloader();
+			
+			return getOdaConnection();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IDataSetMetaData.getConnection()" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IResultSet getDataSourceObjects( String catalog,
+											String schema,
+											String object,
+											String version)
+											throws OdaException
+	{
+		String context = "OdaDataSetMetaData.getDataSourceObjects( " +
+						 catalog + ", " + schema + ", " + object +
+						 ", " + version + ")\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IResultSet resultSet = getDataSetMetaData().getDataSourceObjects( catalog, 
+																				 schema, 
+																				 object, 
+																				 version );
+			
+			OdaResultSet ret =
+				( resultSet == null ) ? null :
+				new OdaResultSet( resultSet, getOdaConnection(), 
+				                  switchContextClassloader(),
+								  getDriverClassLoader() );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IDataSetMetaData.getDataSourceObjects( String catalog, " + 
+								 "String schema, String object, String version )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getDataSourceMajorVersion() throws OdaException
+	{
+		try
+		{
+			setContextClassloader();
+			
+			return getDataSetMetaData().getDataSourceMajorVersion();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IDataSetMetaData.getDataSourceMajorVersion()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getDataSourceMinorVersion() throws OdaException
+	{
+		try
+		{
+			setContextClassloader();
+			
+			return getDataSetMetaData().getDataSourceMinorVersion();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IDataSetMetaData.getDataSourceMinorVersion()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getDataSourceProductName() throws OdaException
+	{
+		try
+		{
+			setContextClassloader();
+			
+			return getDataSetMetaData().getDataSourceProductName();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IDataSetMetaData.getDataSourceProductName()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getDataSourceProductVersion() throws OdaException
+	{
+		try
+		{
+			setContextClassloader();
+			
+			return getDataSetMetaData().getDataSourceProductVersion();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IDataSetMetaData.getDataSourceProductVersion()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getSQLStateType() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.getSQLStateType()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getDataSetMetaData().getSQLStateType();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IDataSetMetaData.getSQLStateType()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean supportsMultipleOpenResults() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.supportsMultipleOpenResults()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getDataSetMetaData().supportsMultipleOpenResults();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IDataSetMetaData.supportsMultipleOpenResults()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean supportsMultipleResultSets() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.supportsMultipleResultSets()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = checkSupportForMultipleResultSets();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IDataSetMetaData.supportsMultipleResultSets()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	boolean checkSupportForMultipleResultSets() throws OdaException
+	{
+		return getDataSetMetaData().supportsMultipleResultSets();
+	}
+	
+	public boolean supportsNamedResultSets() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.supportsNamedResultSets()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = checkSupportForNamedResultSets();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IDataSetMetaData.supportsNamedResultSets()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	boolean checkSupportForNamedResultSets() throws OdaException
+	{
+		return getDataSetMetaData().supportsNamedResultSets();
+	}
+
+	public boolean supportsNamedParameters() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.supportsNamedParameters()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = checkSupportForNamedParameters();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IDataSetMetaData.supportsNamedParameters()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	boolean checkSupportForNamedParameters() throws OdaException
+	{
+		return getDataSetMetaData().supportsNamedParameters();
+	}
+	
+	public boolean supportsInParameters() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.supportsInParameter()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getDataSetMetaData().supportsInParameters();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IDataSetMetaData.supportsInParameters()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean supportsOutParameters() throws OdaException
+	{
+		String context = "OdaDataSetMetaData.supportsOutParameters()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getDataSetMetaData().supportsOutParameters();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IDataSetMetaData.supportsOutParameters()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getSortMode()
+	{
+		String context = "OdaDataSetMetaData.getSortMode()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int sortMode = getDataSetMetaData().getSortMode();
+			
+			logMethodExitWithReturn( context, sortMode );
+			return sortMode;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IDataSetMetaData.getSortMode()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// never gets here
+		return 0;
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDriver.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDriver.java
new file mode 100644
index 0000000..f69c09f
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDriver.java
@@ -0,0 +1,385 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.util.Locale;
+
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.datatools.connectivity.oda.IConnection;
+import org.eclipse.datatools.connectivity.oda.IDriver;
+import org.eclipse.datatools.connectivity.oda.LogConfiguration;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.consumer.nls.Messages;
+import org.eclipse.datatools.connectivity.oda.util.logging.LogManager;
+import org.eclipse.datatools.connectivity.oda.util.manifest.ExtensionManifest;
+import org.eclipse.datatools.connectivity.oda.util.manifest.JavaRuntimeInterface;
+import org.eclipse.datatools.connectivity.oda.util.manifest.RuntimeInterface;
+import org.osgi.framework.Bundle;
+
+/**
+ * OdaDriver is the Oda wrapper for driver connection factories.
+ */
+public class OdaDriver extends OdaObject
+								  implements IDriver
+{
+	private String m_logDirectory;
+	private Object m_appContext;
+
+	public OdaDriver( ExtensionManifest driverConfig )
+		throws OdaException
+	{
+	    assert( driverConfig != null );
+        
+		final String context = "OdaDriver.OdaDriver( " +
+						 driverConfig + " )\t";
+		logMethodCalled( context );
+		
+		RuntimeInterface runtime = driverConfig.getRuntimeInterface();
+		assert( runtime instanceof JavaRuntimeInterface );
+		JavaRuntimeInterface javaRuntime = (JavaRuntimeInterface) runtime;
+		
+		String initEntryPoint = javaRuntime.getDriverClass();
+		
+		boolean setJavaThreadContextClassLoader = javaRuntime.needSetThreadContextClassLoader();
+		setSwitchContextClassLoader( setJavaThreadContextClassLoader );
+		
+		try
+		{
+			Bundle bundle = Platform.getBundle( driverConfig.getNamespace() );
+			Class driverClass = bundle.loadClass( initEntryPoint );
+			ClassLoader classloader = driverClass.getClassLoader();
+			setThreadContextClassLoader( classloader );
+			
+			if( setJavaThreadContextClassLoader )
+				Thread.currentThread().setContextClassLoader( classloader );
+			
+			IDriver newDriver = newDriverInstance( driverClass );
+
+			// store the connection factory instance within this OdaDriver
+			setObject( newDriver );
+			
+			logMethodExitWithReturn( context, this );
+		}
+		catch( Exception ex )
+		{
+			// append the caught classloader-related exception's string to the new OdaException
+			OdaException odaEx = 
+				new OdaHelperException( Messages.helper_cannotConstructConnectionFactory, 
+										 initEntryPoint );
+			odaEx.initCause( ex );
+			handleError( odaEx );
+		}
+		finally
+		{
+			if( setJavaThreadContextClassLoader )
+				Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
+		}
+	}
+
+	public OdaDriver( String driverClassName, Locale locale,
+								 ClassLoader classloader, 
+								 boolean switchContextClassloader ) 
+		throws OdaException
+	{
+		super( switchContextClassloader, classloader );
+		
+		final String context = "OdaDriver.OdaDriver( " +
+						 driverClassName + ", " + locale + ", " + 
+						 classloader + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{	
+			if( switchContextClassloader )
+				Thread.currentThread().setContextClassLoader( classloader );
+			
+			// If the classloader argument is null, then use the classloader that
+			// loaded this class to find the driver's connection factory class and 
+			// construct an instance of the connection factory class. (old scheme)
+			// If the classloader argument isn't null, then we'll use the classloader to 
+			// construct an instance of the underlying connection factory class. (new scheme)
+			Class driverClass = ( classloader == null ) ?
+					Class.forName( driverClassName ) :
+					classloader.loadClass( driverClassName );
+					
+			IDriver newDriver = newDriverInstance( driverClass );
+
+			// store the driver instance within this wrapper
+			setObject( newDriver );
+			
+			logMethodExitWithReturn( context, this );
+		}
+		catch( Exception ex )
+		{
+			// append the caught classloader-related exception's string to the new OdaException
+			OdaException odaEx = 
+				new OdaHelperException( Messages.helper_cannotConstructConnectionFactory, 
+										 driverClassName + ", " + classloader );
+			odaEx.initCause( ex );
+			handleError( odaEx );
+		}
+		finally
+		{
+			if( switchContextClassloader )
+				Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
+		}
+	}
+	
+	private IDriver newDriverInstance( Class driverClass ) throws InstantiationException, IllegalAccessException
+	{
+		Object driverInstance = driverClass.newInstance();
+		
+		if( driverInstance instanceof IDriver )
+			return ( IDriver ) driverInstance;
+		
+		return newDriverBridge( driverInstance );
+	}
+
+	/**
+	 * Override this method to wrap the driver object and return an 
+	 * IDriver.  Subclasses may need to override this method to introduce 
+	 * a wrapper layer to include additional functionality to an ODA driver or to 
+	 * serve as an adaptor to underlying objects that do not implement the 
+	 * org.eclipse.datatools.connectivity.oda interfaces.
+	 * @param driver		a driver object, which may or may 
+	 * 						not implement the org.eclipse.datatools.connectivity.oda.IDriver 
+	 * 						interface.  It cannot be null.
+	 * @return	an org.eclipse.datatools.connectivity.oda.IDriver instance.
+	 */
+	protected IDriver newDriverBridge( Object driver )
+	{
+		// sub-class must override for non DTP ODA driver class
+		throw new IllegalArgumentException( driver.toString() );
+	}
+
+	private IDriver getDriver()
+	{
+		return (IDriver) getObject();
+	}
+
+	private String getLoggerName()
+	{
+	    return sm_loggerName;
+	}
+
+	public void setLogDirectory( String logDirectory )
+	{
+		m_logDirectory = logDirectory;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IDriver#setLogConfiguration(org.eclipse.datatools.connectivity.oda.LogConfiguration)
+	 */
+	public void setLogConfiguration( LogConfiguration logConfig ) throws OdaException
+	{
+	    final String context = "OdaDriver.setLogConfiguration( " + 
+						 logConfig + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			// set the ODA consumer manager's log directory to the ODA driver's 
+			// log directory only the first time setLogConfiguration() is called and 
+			// if the caller didn't already specify a directory using setLogDirectory().
+			if( LogManager.getLogger( getLoggerName() ) == null && 
+				m_logDirectory == null )
+				m_logDirectory = logConfig.getLogDirectory();
+
+            // set log configuration values in the ODA consumer helper of the driver,
+            // whose logging requires a log directory
+            if( m_logDirectory != null && m_logDirectory.length() > 0 )			
+                LogManager.getLogger( getLoggerName(), logConfig.getLogLevel(), 
+								  m_logDirectory, "OdaHelperLog", null );
+			
+            // set log configuration values in the underlying ODA driver
+			getDriver().setLogConfiguration( logConfig );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			logUnsupportedOp( uoException,
+							  "IDriver.setLogConfiguration" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		logMethodExit( context );
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IDriver#getConnection(java.lang.String)
+	 */
+	public IConnection getConnection( String dataSourceId )
+		throws OdaException
+	{
+	    final String context = "OdaDriver.getConnection( " +
+							dataSourceId + " )\t";
+		logMethodCalled( context );
+		try
+		{
+			setContextClassloader();
+			
+			IConnection connection = getDriver().getConnection( dataSourceId );
+			IConnection ret = ( connection == null ) ? null :
+							  newConnectionHelper( connection );
+			
+			logMethodExitWithReturn( context, ret );			
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IDriver.getConnection( String dataSourceId )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException exception )
+		{
+			handleError( exception );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	protected IConnection newConnectionHelper( IConnection connection )
+		throws OdaException
+	{	
+	    OdaConnection connHelper = new OdaConnection( connection, 
+				                  switchContextClassloader(),
+								  getDriverClassLoader() );
+	    
+		// pass-thru driver context to the newly obtained
+		// connection helper so it can pass thru before open()
+	    connHelper.setDriverAppContext( m_appContext );
+        
+	    // applies the max limit to all instances
+	    int maxOpenConnections;
+	    try
+	    {
+	        maxOpenConnections = getMaxConnections();
+	    }
+	    catch( OdaException ex )
+	    {
+	        maxOpenConnections = 0;		// default to 0 for unknown
+	    }
+	    OdaConnection.setMaxConnections( maxOpenConnections );
+
+	    return connHelper;
+	}
+	
+	/* (non-Javadoc)
+	 * @see org.eclipse.datatools.connectivity.oda.IDriver#getMaxConnections()
+	 */
+	public int getMaxConnections() throws OdaException
+	{
+	    final String context = "OdaDriver.getMaxConnections()\t";
+		logMethodCalled( context );
+
+		try
+		{			
+			setContextClassloader();
+			
+			int ret = getDriver().getMaxConnections();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException, 
+												  "IDriver.getMaxConnections()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnNegOne( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnNegOne( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	/* 
+	 * @see org.eclipse.datatools.connectivity.oda.IDriver#setAppContext(java.lang.Object)
+	 */
+	public void setAppContext( Object context ) throws OdaException
+	{
+		final String methodName = "OdaDriver.setAppContext()\t";
+		final String contextObjInfo = ( context == null ) ? "null" : context.toString();
+		logMethodCalled( methodName );
+
+		if( m_appContext == context )	// already set
+		{
+		    log( methodName, "Same pass-thru application context object: " + contextObjInfo );
+			logMethodExit( methodName );
+		    return;		// nothing to do
+		}
+		
+		try
+		{
+			setContextClassloader();
+			
+		    log( methodName, "Passing thru application context to underlying ODA driver: " + contextObjInfo );
+			getDriver().setAppContext( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			// log, and ignore exception
+			logUnsupportedOp( uoException, "IDriver.setAppContext" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// if no exception with passing thru to the underlying driver,
+		// hold on to context for subsequent pass-thru to each of its
+		// connection before open() and queries before prepare
+		m_appContext = context;
+		
+		logMethodExit( methodName );
+	}
+
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDriverObject.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDriverObject.java
new file mode 100644
index 0000000..ebcfece
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaDriverObject.java
@@ -0,0 +1,46 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaDriverObject is the base class for all Oda wrapper objects that 
+ * needs a reference to its corresponding Oda connection wrapper object. 
+ * This also extends some of the OdaObject error handling capabilities.
+ */
+class OdaDriverObject extends OdaObject
+{
+	private OdaConnection m_connection;
+	
+	OdaDriverObject( Object obj, OdaConnection connection, 
+	                 boolean switchContextClassloader,
+					 ClassLoader driverClassLoader )
+	{
+		super( obj, switchContextClassloader, driverClassLoader );
+		m_connection = connection;
+	}
+	
+	protected OdaConnection getOdaConnection()
+	{
+		return m_connection;
+	}
+	
+	protected void handleError( OdaException exception ) throws OdaException
+	{
+		m_connection.handleError( exception );
+	}
+
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaHelperException.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaHelperException.java
new file mode 100644
index 0000000..6e663bb
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaHelperException.java
@@ -0,0 +1,78 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.util.Locale;
+
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * Exception thrown for errors that occur within the 
+ * ODA consumer helper package.  It encapsulates the handling
+ * of additional formatting of the error messages.
+ */
+public class OdaHelperException extends OdaException
+{	
+	private String m_errorMsg;
+	private String m_appendInfo;
+	
+	public OdaHelperException( String errorMsg, String appendInfo )
+	{
+		m_errorMsg = errorMsg;
+		m_appendInfo = appendInfo;
+	}
+	
+	/**
+	 * @deprecated Replaced by {@link #OdaHelperException(String, String)}
+	 */
+	public OdaHelperException( int errorNumber, Locale locale, String appendInfo )
+	{
+		// migrated to NLS resource handling;
+		// no more errorNumber map available, use it as the error message
+		m_errorMsg = Integer.toString( errorNumber );
+		m_appendInfo = appendInfo;
+	}
+	
+	public String getMessage()
+	{
+		return getLocalizedMessage();
+	}
+	
+	public String getLocalizedMessage()
+	{
+		return m_errorMsg;
+	}
+	
+	public String toString()
+	{
+		String ret = getClass().getName();
+		String localizedMessage = getLocalizedMessage();
+		if( localizedMessage != null && localizedMessage.length() > 0 )
+			ret += ": " + localizedMessage; //$NON-NLS-1$
+		
+		if( m_appendInfo != null && m_appendInfo.length() > 0 )
+			ret += " (" + m_appendInfo + ")"; //$NON-NLS-1$ //$NON-NLS-2$
+		
+		Throwable cause = getCause();
+		if( cause != null )
+		{
+			String causeString = cause.toString();
+			if( causeString != null && causeString.length() > 0 )
+				ret += " ;\n" + causeString; //$NON-NLS-1$
+		}
+		
+		return ret;
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaObject.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaObject.java
new file mode 100644
index 0000000..53b80bc
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaObject.java
@@ -0,0 +1,392 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.sql.Types;
+
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.consumer.nls.Messages;
+import org.eclipse.datatools.connectivity.oda.util.logging.LogManager;
+import org.eclipse.datatools.connectivity.oda.util.logging.Logger;
+
+/**
+ * OdaObject is the base class for all Oda wrapper objects.  The 
+ * wrapper objects inherits reflection and error handling behavior 
+ * from this class.
+ */
+class OdaObject
+{
+	private Object 			m_object;
+	private boolean			m_switchContextClassloader;
+	private ClassLoader		m_driverClassLoader;
+	
+	static final String sm_loggerName = "org.eclipse.datatools.connectivity.oda";
+	
+	private static boolean sm_ThrowExceptionOnly = true;
+	
+	/*
+	 * Static method to be used by host to have oda consumer manager return errors 
+	 * in the form of a driver error.
+	 */ 
+	public static void setThrowAndSetOdaException()
+	{
+		sm_ThrowExceptionOnly = false;
+	}
+
+	protected OdaObject()
+	{
+	}
+	
+	protected OdaObject( boolean switchContextClassloader, 
+						 ClassLoader driverClassLoader )
+	{
+		m_object = null;
+		m_switchContextClassloader = switchContextClassloader;
+		m_driverClassLoader = driverClassLoader;
+	}
+	
+	protected OdaObject( Object obj, boolean switchContextClassloader,
+						 ClassLoader driverClassLoader )
+	{
+		m_object = obj;
+		m_switchContextClassloader = switchContextClassloader;
+		m_driverClassLoader = driverClassLoader;
+	}
+	
+	protected void setThreadContextClassLoader( ClassLoader classloader )
+	{
+		m_driverClassLoader = classloader;
+	}
+	
+	protected void setSwitchContextClassLoader( boolean needSwitch )
+	{
+		m_switchContextClassloader = needSwitch;
+	}
+
+	protected void setObject( Object obj )
+	{
+		m_object = obj;
+	}
+	
+	protected Object getObject()
+	{
+		return m_object;
+	}
+	
+	protected boolean switchContextClassloader()
+	{
+		return m_switchContextClassloader;
+	}
+	
+	protected ClassLoader getDriverClassLoader()
+	{
+		return m_driverClassLoader;
+	}
+	
+	protected void setContextClassloader()
+	{
+		if( m_switchContextClassloader && m_driverClassLoader != null )
+			Thread.currentThread().setContextClassLoader( m_driverClassLoader );
+	}
+	
+	protected void resetContextClassloader()
+	{
+		if( m_switchContextClassloader )
+		{
+			ClassLoader originalLoader = this.getClass().getClassLoader();
+			Thread.currentThread().setContextClassLoader( originalLoader );
+		}
+	}
+	
+	/*
+	 * Reflection capability to call methods that aren't part of the Oda interface. 
+	 * This will internally set and reset the context classloader for the reflection 
+	 * invocation.
+	 */
+	public Object findAndInvokeMethod( String methodName, Class[] parameterTypes,
+									   Object[] args ) 
+		throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
+			   OdaException
+	{
+		// the callers of this method are not ODA interface methods, so they have 
+		// not already set the context classloader, so do it here
+		return findAndInvokeMethod( methodName, parameterTypes, args, 
+									false /* bypassJavaAccessChecks */,
+									true /* doSetContextClassloader */ );
+	}
+	
+	/*
+	 * Pass in an additional boolean flag for setting context classloader 
+	 * because this method may be called by a method which already has the 
+	 * context classloader set.  Therefore, we don't want to unset it. 
+	 */
+	Object findAndInvokeMethod( String methodName, Class[] parameterTypes,
+			   					Object[] args, boolean bypassJavaAccessChecks, 
+			   					boolean doSetContextClassloader ) 
+		throws NoSuchMethodException, IllegalAccessException, InvocationTargetException,
+			   OdaException
+	{
+		try
+		{
+			if( doSetContextClassloader )
+				setContextClassloader();
+			
+			Class objClass = m_object.getClass();
+			Method method = objClass.getMethod( methodName, parameterTypes );
+			
+			// needed for methods where we need to provide backwards 
+			// compatibility, but the implementation classes are not public
+			// then the method is inaccessible, try to bypass the Java language access checks
+			if( bypassJavaAccessChecks && ! method.isAccessible() )
+			{
+				try
+				{
+					method.setAccessible( true );
+				}
+				catch( SecurityException ex )
+				{
+					// may get a SecurityException when trying to bypass the Java access checks
+					// method contains the context specific info: "public void <package>.<class>.<method>( <args> )"
+					handleError( newOdaException( Messages.helper_inadequatePermissionsForCompatibility,
+												  ex, method.toString() ) );
+				}
+			}
+			
+			return method.invoke( m_object, args );
+		}
+		finally
+		{
+			if( doSetContextClassloader )
+				resetContextClassloader();
+		}
+	}
+	
+	//-------------------------------------------------------------------------
+	// The following methods are used by subclasses to handle OdaExceptions and 
+	// runtime exceptions.
+	
+	protected void handleError( RuntimeException exception )
+	{
+		// this will log at a severe level because these runtime exceptions
+		// are thrown back to the caller and will halt the report generation
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.severe( exception );
+		
+		throw exception;
+	}
+	
+	protected void handleError( OdaException exception ) throws OdaException
+	{
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.severe( exception );
+		
+		if( sm_ThrowExceptionOnly )
+			throw exception;
+	}
+
+	protected int handleErrorAndReturnZero( RuntimeException rtException )
+	{
+		handleError( rtException );
+		return 0;
+	}
+	
+	protected int handleErrorAndReturnZero( OdaException exception ) throws OdaException
+	{
+		handleError( exception );
+		return 0;
+	}
+
+	protected int handleErrorAndReturnNegOne( RuntimeException rtException )
+	{
+		handleError( rtException );
+		return -1;
+	}
+	
+	protected int handleErrorAndReturnNegOne( OdaException exception ) throws OdaException
+	{
+		handleError( exception );
+		return -1;
+	}
+	
+	protected String handleErrorAndReturnEmptyString( RuntimeException rtException )
+	{
+		handleError( rtException );
+		return "";
+	}
+
+	protected String handleErrorAndReturnEmptyString( OdaException exception ) throws OdaException
+	{
+		handleError( exception );
+		return "";
+	}
+
+	protected boolean handleErrorAndReturnFalse( RuntimeException rtException )
+	{
+		handleError( rtException );
+		return false;
+	}
+	
+	protected boolean handleErrorAndReturnFalse( OdaException exception ) throws OdaException
+	{
+		handleError( exception );
+		return false;
+	}
+
+	protected int handleErrorAndReturnTypeNull( RuntimeException rtException )
+	{
+		handleError( rtException );
+		return Types.NULL;
+	}
+	
+	protected int handleErrorAndReturnTypeNull( OdaException exception ) throws OdaException
+	{
+		handleError( exception );
+		return Types.NULL;
+	}
+	
+	protected void handleUnsupportedOp( UnsupportedOperationException exception,
+										String context )
+	{
+		// want to log the old exception because our new exception will have
+		// a different stack trace than the old one and the user will want 
+		// to see the old stack trace in the logs.
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.severe( exception );
+		
+		// we'll have to reconstruct a new exception object if the 
+		// existing exception doesn't have a message because the 
+		// Exception class has no setters for message.
+		String exceptionMsg = exception.getLocalizedMessage();
+		exception = 
+			( exceptionMsg == null || exceptionMsg.length() == 0 ) ?
+			new UnsupportedOperationException( context ) : exception;
+		
+		throw exception;
+	}
+	
+	protected int handleUnsupportedOpAndRetZero( UnsupportedOperationException exception,
+												 String context )
+	{
+		handleUnsupportedOp( exception, context );
+		return 0;
+	}
+	
+	protected boolean handleUnsupportedOpAndRetFalse( UnsupportedOperationException exception,
+													  String context )
+	{
+		handleUnsupportedOp( exception, context );
+		return false;
+	}
+	
+	protected String handleUnsupportedOpAndRetEmptyString( UnsupportedOperationException exception,
+														   String context )
+	{
+		handleUnsupportedOp( exception, context );
+		return "";
+	}
+	
+	protected int handleUnsupportedOpAndRetTypeNull( UnsupportedOperationException exception,
+													 String context )
+	{
+		handleUnsupportedOp( exception, context );
+		return Types.NULL;
+	}
+
+	protected void logUnsupportedOp( UnsupportedOperationException exception,
+									 String context )
+	{
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+		{
+		    String logMsg = exception.getLocalizedMessage();
+		    if ( logMsg == null || logMsg.length() == 0 )
+		        logMsg = context;
+		    else
+		        logMsg = context + ": " + logMsg;
+			logger.warning( logMsg );
+		}
+	}
+	
+	protected void log( String context, String msg )
+	{
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.fine( context + msg );
+	}
+	
+	protected void logMethodExitWithReturn( String context, int i )
+	{
+		logMethodExitWithReturn( context, new Integer( i ) );
+	}
+	
+	protected void logMethodExitWithReturn( String context, double d )
+	{
+		logMethodExitWithReturn( context, new Double( d ) );
+	}
+	
+	protected void logMethodExitWithReturn( String context, boolean b )
+	{
+		logMethodExitWithReturn( context, b ? Boolean.TRUE : Boolean.FALSE );
+	}
+
+	protected void logMethodCalled( String context )
+	{
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.fine( context + "Called." );
+	}
+	
+	protected void logMethodExit( String context )
+	{
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.fine( context + "Exiting." );
+	}
+		
+	protected void logMethodExitWithReturn( String context, Object obj )
+	{
+		Logger logger = LogManager.getLogger( sm_loggerName );
+		if( logger != null )
+			logger.fine( context + "Returns [ " + obj + " ]" );
+	}
+	
+	protected OdaException newOdaException( String errorMsg )
+	{
+		return new OdaHelperException( errorMsg, null /* appendInfo */ );
+	}
+	
+	protected OdaException newOdaException( String errorMsg, 
+											Throwable cause )
+	{
+		OdaException odaEx = newOdaException( errorMsg );
+		odaEx.initCause( cause );
+		return odaEx;
+	}
+	
+	OdaException newOdaException( String errorMsg, Throwable cause, 
+			  String appendInfo )
+	{
+		OdaException odaEx = new OdaHelperException( errorMsg, 
+				  					appendInfo );
+		odaEx.initCause( cause );
+		return odaEx;
+	}
+
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaParameterMetaData.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaParameterMetaData.java
new file mode 100644
index 0000000..37f72bf
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaParameterMetaData.java
@@ -0,0 +1,290 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaParameterMetaData is the Oda wrapper for parameter metadata.
+ */
+class OdaParameterMetaData extends OdaDriverObject 
+						   implements IParameterMetaData
+{
+	protected OdaParameterMetaData( IParameterMetaData parameterMetaData,
+									OdaConnection connection,
+									boolean switchContextClassloader,
+									ClassLoader driverClassLoader )
+	{
+		super( parameterMetaData, connection, switchContextClassloader,
+			   driverClassLoader );
+		
+		String context = "OdaParameterMetaData.OdaParameterMetaData( " +
+						 parameterMetaData + ", " + connection + " )\t";
+		logMethodExitWithReturn( context, this );
+	}
+	
+	private IParameterMetaData getParameterMetaData()
+	{
+		return (IParameterMetaData) getObject();
+	}
+	
+	//------------------------------------------------------------------
+	//	IParameterMetaData public interface methods
+	//------------------------------------------------------------------	
+
+	public int getParameterCount() throws OdaException
+	{
+		String context = "OdaParameterMetaData.getParameterCount()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getParameterMetaData().getParameterCount();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IParameterMetaData.getParameterCount()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getParameterMode( int param ) throws OdaException
+	{
+		String context = "OdaParameterMetaData.getParameterMode( " + 
+						 param + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getParameterMetaData().getParameterMode( param );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IParameterMetaData.getParameterMode( int param )" );
+			return IParameterMetaData.parameterModeUnknown;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return IParameterMetaData.parameterModeUnknown;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return IParameterMetaData.parameterModeUnknown;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getParameterType( int param ) throws OdaException
+	{
+		String context = "OdaParameterMetaData.getParameterType( " + 
+						 param + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getParameterMetaData().getParameterType( param );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetTypeNull( uoException,
+													  "IParameterMetaData.getParameterType( int param )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnTypeNull( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnTypeNull( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getParameterTypeName( int param ) throws OdaException
+	{
+		String context = "OdaParameterMetaData.getParameterTypeName( " + 
+						 param + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String ret = getParameterMetaData().getParameterTypeName( param );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IParameterMetaData.getParameterTypeName( int param )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getPrecision( int param ) throws OdaException
+	{
+		String context = "OdaParameterMetaData.getPrecision( " + param + 
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getParameterMetaData().getPrecision( param );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IParameterMetaData.getPrecision( int param )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnNegOne( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnNegOne( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getScale( int param ) throws OdaException
+	{
+		String context = "OdaParameterMetaData.getScale( " +
+						 param + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getParameterMetaData().getScale( param );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IParameterMetaData.getScale( int param )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnNegOne( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnNegOne( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int isNullable( int param ) throws OdaException
+	{
+		String context = "OdaParameterMetaData.isNullable( " +
+						 param + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getParameterMetaData().isNullable( param );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IParameterMetaData.isNullable( int param )" );
+			return IParameterMetaData.parameterNullableUnknown;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return IParameterMetaData.parameterNullableUnknown;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return IParameterMetaData.parameterNullableUnknown;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaQuery.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaQuery.java
new file mode 100644
index 0000000..3be52c4
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaQuery.java
@@ -0,0 +1,1165 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import org.eclipse.datatools.connectivity.oda.IParameterMetaData;
+import org.eclipse.datatools.connectivity.oda.IQuery;
+import org.eclipse.datatools.connectivity.oda.IResultSet;
+import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.SortSpec;
+import org.eclipse.datatools.connectivity.oda.consumer.nls.Messages;
+
+/**
+ * OdaQuery is the ODA wrapper for query statements.
+ */
+public class OdaQuery extends OdaDriverObject implements IQuery
+{
+	// isPreparedSuccessfully can only be set to true if 
+	// the underlying ODA provider prepare() call succeeds
+	private boolean				m_isPreparedSuccessfully;
+	private boolean 			m_isExecuted;
+	private String 				m_dataSetType;
+	private Object 				m_appContext;
+		
+	protected OdaQuery( IQuery statement, OdaConnection connection,
+							String dataSetType, boolean switchContextClassloader,
+							ClassLoader driverClassLoader )
+	{
+		super( statement, connection, switchContextClassloader,
+			   driverClassLoader );
+		
+		final String context = "OdaQuery.OdaQuery( " + statement +
+						 ", " + connection + ", " + dataSetType + " )\t";
+		logMethodCalled( context );
+		
+		m_isPreparedSuccessfully = false;
+		m_isExecuted = false;
+		m_dataSetType = dataSetType;
+				
+		logMethodExitWithReturn( context, this );
+	}
+	
+	protected IQuery getQuery()
+	{
+		return (IQuery) getObject();
+	}
+	
+	protected OdaDataSetMetaData getDSMetaData() throws OdaException
+	{
+		return getOdaConnection().doGetMetaData( m_dataSetType );
+	}
+	
+	protected boolean isPreparedSuccessfully()
+	{
+		return m_isPreparedSuccessfully;
+	}
+	
+	protected boolean isExecuted()
+	{
+		return m_isExecuted;
+	}
+	
+	protected void setIsExecuted( boolean flag )
+	{
+		m_isExecuted = flag;
+	}
+	
+	private void resetStatementStates()
+	{
+		// need to decrement the open statement count when we reset the 
+		// statement states for prepare() and close()
+		getOdaConnection().removeOpenStatement( this );
+		
+		// reset the statement states
+		m_isPreparedSuccessfully = false;
+		resetExecuteStates();
+	}
+
+	protected void resetExecuteStates() 
+	{
+		m_isExecuted = false;
+	}
+	
+	//------------------------------------------------------------------
+	//	IQuery public interface methods
+	//------------------------------------------------------------------
+	
+	/* 
+	 * @see org.eclipse.datatools.connectivity.oda.IQuery#setAppContext(java.lang.Object)
+	 */
+	public void setAppContext( Object context ) throws OdaException
+	{
+		final String methodName = "OdaQuery.setAppContext()\t";
+		final String contextObjInfo = ( context == null ) ? "null" : context.toString();
+		logMethodCalled( methodName );
+
+		if( m_appContext == context )	// already set
+		{
+		    log( methodName, "Same pass-thru application context object: " + contextObjInfo );
+			logMethodExit( methodName );
+		    return;		// nothing to do
+		}
+
+		try
+		{
+			setContextClassloader();
+			
+		    log( methodName, "Passing thru application context to underlying ODA query: " + contextObjInfo );
+			getQuery().setAppContext( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			// log, and ignore exception
+			logUnsupportedOp( uoException, "IQuery.setAppContext" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// if no exception with passing thru to the underlying connection,
+		// hold on to context to verify whether a new one is being passed thru
+		m_appContext = context;
+		
+		logMethodExit( methodName );
+	}
+
+	public void prepare( String queryText ) throws OdaException
+	{
+	    final String context = "OdaQuery.prepare( " + queryText + " )\t";
+		logMethodCalled( context );
+		
+		final String unsupportedOpContext = "IQuery.prepare( String queryText )";
+		
+		// pass-thru connection context to the underlying query
+		// before calling prepare()
+		setAppContext( getOdaConnection().getAppContext() );
+		
+		try
+		{	
+			setContextClassloader();	
+			doPrepare( queryText, context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, unsupportedOpContext );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// prepare didn't throw an exception, so the statement has been prepared.
+		m_isPreparedSuccessfully = true;
+		getOdaConnection().addOpenStatement( this );	
+		
+		logMethodExit( context );
+	}
+	
+	private void doPrepare( String queryText, String logContext ) throws OdaException
+	{
+		// will need to reset statement states if we're re-preparing a 
+		// statement
+		resetStatementStates();
+		
+		// check whether the queryText is valid according to the ODA interfaces spec,
+		// i.e. not null; if null, convert it to an empty string
+ 		if( queryText == null )
+ 		{
+		    log( logContext, "Converted the null queryText argument to an empty String value to comply with the ODA interfaces specification." );
+ 			queryText = "";
+ 		}
+		
+		if( ! getOdaConnection().canSupportMoreOpenedStatements() )
+			throw newOdaException( Messages.helper_maxConcurrentStatementsReached );
+		
+		getQuery().prepare( queryText );
+	}
+
+	public void setProperty( String propertyName, String propertyValue )
+		throws OdaException
+	{
+	    final String context = "OdaQuery.setProperty( " + propertyName +
+						 ", " + propertyValue + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{	
+			setContextClassloader();
+			
+			getQuery().setProperty( propertyName, propertyValue );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setProperty( String propertyName, " + 
+								 "String propertyValue )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void close() throws OdaException
+	{
+	    final String context = "OdaQuery.close()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getQuery().close();
+			
+			resetStatementStates();
+			m_dataSetType = null;
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.close()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setMaxRows( int max ) throws OdaException
+	{
+	    final String context = "OdaQuery.setMaxRows( " + max + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getQuery().setMaxRows( max );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IQuery.setMaxRows()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		logMethodExit( context );
+	}
+
+	public int getMaxRows() throws OdaException
+	{
+	    final String context = "OdaQuery.getMaxRows()\t";
+		logMethodCalled( context );
+		int ret = 0;
+		
+		try
+		{
+			setContextClassloader();
+			
+			ret = getQuery().getMaxRows();
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IQuery.getMaxRows()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+
+	public IResultSetMetaData getMetaData() throws OdaException
+	{
+	    final String context = "OdaQuery.getMetaData()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+
+			OdaResultSetMetaData ret = doGetMetaData();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.getMetaData()" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	private OdaResultSetMetaData doGetMetaData() throws OdaException
+	{
+		if( ! isPreparedSuccessfully() )
+			throw newOdaException( Messages.helper_cannotGetResultSetMdBeforePrepare );	
+		
+		IResultSetMetaData resultSetMetaData = getQuery().getMetaData();
+		
+		OdaResultSetMetaData ret =
+			( resultSetMetaData == null ) ? null :
+			new OdaResultSetMetaData( resultSetMetaData, getOdaConnection(),
+			                          switchContextClassloader(),
+									  getDriverClassLoader() );
+		
+		return ret;
+	}
+
+	public IResultSet executeQuery() throws OdaException
+	{
+	    final String context = "OdaQuery.executeQuery()\t";
+		logMethodCalled( context );
+		
+		try
+		{	
+			setContextClassloader();
+
+			OdaResultSet ret = doExecuteQuery();
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.executeQuery()" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	private OdaResultSet doExecuteQuery() throws OdaException
+	{
+		// possibly re-executing, so need to reset the execute states
+		// from a previous execute.
+		resetExecuteStates();
+		
+		if( ! isPreparedSuccessfully() )
+			throw newOdaException( Messages.helper_cannotExecuteBeforePrepare );
+		
+		IResultSet resultSet = getQuery().executeQuery();
+		m_isExecuted = true;
+		
+		if( resultSet == null )
+			return null;
+
+		OdaResultSet ret = newResultSetHelper( resultSet );
+							 
+		return ret;
+	}
+	
+	protected OdaResultSet newResultSetHelper( IResultSet resultSet )
+	{
+		return new OdaResultSet( resultSet, getOdaConnection(),
+			                     switchContextClassloader(),
+								 getDriverClassLoader() );
+	}
+
+	public void setInt( String parameterName, int value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setInt( " + parameterName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setInt( parameterName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setInt( String parameterName, int value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setInt( int parameterId, int value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setInt( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{	
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setInt( parameterId, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IQuery.setInt( int parameterId, int value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDouble( String parameterName, double value )
+		throws OdaException
+	{
+	    final String context = "OdaQuery.setDouble( " + parameterName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setDouble( parameterName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setDouble( String parameterName, double value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDouble( int parameterId, double value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setDouble( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setDouble( parameterId, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setDouble( int parameterId, double value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setBigDecimal( String parameterName, BigDecimal value )
+		throws OdaException
+	{
+	    final String context = "OdaQuery.setBigDecimal( " + parameterName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setBigDecimal( parameterName, value );
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setBigDecimal( String parameterName, BigDecimal value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public void setBigDecimal( int parameterId, BigDecimal value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setBigDecimal( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setBigDecimal( parameterId, value );
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setBigDecimal( int parameterId, BigDecimal value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public void setString( String parameterName, String value )
+		throws OdaException
+	{
+	    final String context = "OdaQuery.setString( " + parameterName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setString( parameterName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setString( String parameterName, String value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setString( int parameterId, String value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setString( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setString( parameterId, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setString( int parameterId, String value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDate( String parameterName, Date value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setDate( " + parameterName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setDate( parameterName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setDate( String parameterName, Date value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDate( int parameterId, Date value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setDate( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setDate( parameterId, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IQuery.setDate( int parameterId, Date value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTime( String parameterName, Time value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setTime( " + parameterName + ", " +
+					 	 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setTime( parameterName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IQuery.setTime( String parameterName, Time value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTime( int parameterId, Time value ) throws OdaException
+	{
+	    final String context = "OdaQuery.setTime( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setTime( parameterId, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setTime( int parameterId, Time value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTimestamp( String parameterName, Timestamp value )
+		throws OdaException
+	{
+	    final String context = "OdaQuery.setTimestamp( " + parameterName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setTimestamp( parameterName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IQuery.setTimestamp( String parameterName, Timestamp value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTimestamp( int parameterId, Timestamp value )
+		throws OdaException
+	{
+	    final String context = "OdaQuery.setTimestamp( " + parameterId + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotSetParamBeforePrepare );
+			
+			getQuery().setTimestamp( parameterId, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IQuery.setTimestamp( int parameterId, Timestamp value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void clearInParameters() throws OdaException
+	{
+	    final String context = "OdaQuery.clearInParameters()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getQuery().clearInParameters();
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+			                     "IQuery.clearInParameters()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public int findInParameter( String parameterName ) throws OdaException
+	{
+	    final String context = "OdaQuery.findInParameter( " + parameterName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotGetParamMdBeforePrepare );
+			
+			int ret = getQuery().findInParameter( parameterName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IQuery.findInParameter( String parameterName )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public IParameterMetaData getParameterMetaData() throws OdaException
+	{
+	    final String context = "OdaQuery.getParameterMetaData()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( Messages.helper_cannotGetParamMdBeforePrepare );
+			
+			IParameterMetaData parameterMetaData = getQuery().getParameterMetaData();
+			
+			// null value means no parameters are defined on query
+			OdaParameterMetaData ret =
+				( parameterMetaData == null ) ? null :
+				new OdaParameterMetaData( parameterMetaData, getOdaConnection(),
+				                            switchContextClassloader(),
+											getDriverClassLoader() );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		// there may be two ways that the underlying driver may indicate that 
+		// the driver doesn't support the IParameterMetaData interface: 
+		// 1. returns a null for getParameterMetaData()
+		// 2. throws an UnsupportedOperationException or OdaException (ODA MySQL JDBC) 
+		//	  for getParameterMetaData()
+		catch( UnsupportedOperationException uoException )
+		{
+			// TODO handle backward compatibility of optional interface
+			handleUnsupportedOp( uoException,
+								 "IQuery.getParameterMetaData()" );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			// TODO handle backward compatibility of optional interface
+			handleError( odaException );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setSortSpec( SortSpec sortBy ) throws OdaException
+	{
+	    final String context = "OdaQuery.setSortSpec( " + sortBy + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			if( ! isPreparedSuccessfully() )
+				throw newOdaException( 
+						Messages.helper_cannotSetSortSpecBeforePrepare );
+			
+			getQuery().setSortSpec( sortBy );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+					 			 "IQuery.setSortSpec( SortSpec sortBy )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public SortSpec getSortSpec() throws OdaException
+	{
+	    final String context = "OdaQuery.getSortSpec()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			SortSpec sortSpec = getQuery().getSortSpec();
+			
+			logMethodExitWithReturn( context, sortSpec );
+			return sortSpec;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IQuery.getSortSpec()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// will never get here
+		return null;
+	}
+	
+	public String getInterfaceName()
+	{
+		return IQuery.class.getName();
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaResultSet.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaResultSet.java
new file mode 100644
index 0000000..add1864
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaResultSet.java
@@ -0,0 +1,1085 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import org.eclipse.datatools.connectivity.oda.IBlob;
+import org.eclipse.datatools.connectivity.oda.IClob;
+import org.eclipse.datatools.connectivity.oda.IResultSet;
+import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.consumer.nls.Messages;
+
+/**
+ * OdaResultSet is the Oda wrapper for result sets.
+ */
+public class OdaResultSet extends OdaDriverObject implements IResultSet
+{
+	protected OdaResultSet( IResultSet resultSet, OdaConnection connection,
+							boolean switchContextClassloader,
+							ClassLoader driverClassLoader )
+	{
+		super( resultSet, connection, switchContextClassloader,
+			   driverClassLoader );
+		
+		String context = "OdaResultSet.OdaResultSet( " + resultSet +
+						 ", " + connection + " )\t";
+		logMethodExitWithReturn( context, this );
+	}
+	
+	protected IResultSet getResultSet()
+	{
+		return (IResultSet) getObject();
+	}
+
+	//------------------------------------------------------------------
+	//	IResultSet public interface methods
+	//------------------------------------------------------------------	
+
+	public IResultSetMetaData getMetaData() throws OdaException
+	{
+		final String context = "OdaResultSet.getMetaData()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IResultSetMetaData resultSetMetaData = getResultSet().getMetaData();
+				
+			OdaResultSetMetaData ret =
+				( resultSetMetaData == null ) ? null :
+				new OdaResultSetMetaData( resultSetMetaData, getOdaConnection(),
+				                          switchContextClassloader(),
+										  getDriverClassLoader() );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getMetaData()" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void close() throws OdaException
+	{
+		final String context = "OdaResultSet.close()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getResultSet().close();
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.close()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setMaxRows( int max ) throws OdaException
+	{
+	    final String context = "OdaResultSet.setMaxRows( " + max + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getResultSet().setMaxRows( max );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IResultSet.setMaxRows( int max )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		logMethodExit( context );
+	}
+
+	public boolean next() throws OdaException
+	{
+	    final String context = "OdaResultSet.next()\t";
+		logMethodCalled( context );
+		
+		// this checking is to ensure that the established connection is still 
+		// active during fetch
+		if( ! getOdaConnection().isOpen() )
+		{
+			OdaException ex = newOdaException( Messages.helper_connectionIsInactive );
+			return handleErrorAndReturnFalse( ex );
+		}
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getResultSet().next();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IResultSet.next()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getRow() throws OdaException
+	{
+	    final String context = "OdaResultSet.getRow()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSet().getRow();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSet.getRow()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getString( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getString( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String ret = getResultSet().getString( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IResultSet.getString( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getString( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getString( " + columnName + 
+					 	 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String ret = getResultSet().getString( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IResultSet.getString( String columnName )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getInt( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getInt( " + index + 
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSet().getInt( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSet.getInt( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getInt( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getInt( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSet().getInt( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSet.getInt( String columnName )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public double getDouble( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getDouble( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			double ret = getResultSet().getDouble( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSet.getDouble( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public double getDouble( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getDouble( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			double ret = getResultSet().getDouble( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSet.getDouble( String columnName )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public BigDecimal getBigDecimal( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getBigDecimal( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			BigDecimal ret = getResultSet().getBigDecimal( index );
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getBigDecimal( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// we'll never get here.
+		return null;
+	}
+	
+	public BigDecimal getBigDecimal( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getBigDecimal( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			BigDecimal ret = getResultSet().getBigDecimal( columnName );
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getBigDecimal( String columnName )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+		
+		// we'll never get here.
+		return null;
+	}
+	
+	public Date getDate( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getDate( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Date ret = getResultSet().getDate( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getDate( int index )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Date getDate( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getDate( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Date ret = getResultSet().getDate( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getDate( String columnName )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Time getTime( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTime( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Time ret = getResultSet().getTime( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IResultSet.getTime( int index )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Time getTime( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTime( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Time ret = getResultSet().getTime( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getTime( String columnName )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Timestamp getTimestamp( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTimestamp( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Timestamp ret = getResultSet().getTimestamp( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getTimestamp( int index )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException exception )
+		{
+			handleError( exception );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public Timestamp getTimestamp( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTimestamp( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			Timestamp ret = getResultSet().getTimestamp( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSet.getTimestamp( String columnName )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IResultSet#getBlob(int)
+     */
+    public IBlob getBlob( int index ) throws OdaException
+    {
+		final String context = "OdaResultSet.getBlob( " + index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IBlob blob = getResultSet().getBlob( index );
+			
+			OdaBlob ret = newBlobWrapper( blob );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IResultSet.getBlob( int index )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IResultSet#getBlob(java.lang.String)
+     */
+    public IBlob getBlob( String columnName ) throws OdaException
+    {
+        final String context = "OdaResultSet.getBlob( " + columnName + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IBlob blob = getResultSet().getBlob( columnName );
+			
+			OdaBlob ret = newBlobWrapper( blob );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IResultSet.getBlob( String columnName )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    private OdaBlob newBlobWrapper( IBlob blob )
+    {
+        return ( blob == null ) ? null : 
+		    new OdaBlob( blob, getOdaConnection(), 
+		            switchContextClassloader(), getDriverClassLoader());
+    }
+    
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IResultSet#getClob(int)
+     */
+    public IClob getClob( int index ) throws OdaException
+    {
+        final String context = "OdaResultSet.getClob( " + index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IClob clob = getResultSet().getClob( index );
+			
+			OdaClob ret = newClobWrapper( clob );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IResultSet.getClob( int index )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+
+    /* (non-Javadoc)
+     * @see org.eclipse.datatools.connectivity.oda.IResultSet#getClob(java.lang.String)
+     */
+    public IClob getClob( String columnName ) throws OdaException
+    {
+        final String context = "OdaResultSet.getClob( " + columnName + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			IClob clob = getResultSet().getClob( columnName );
+			
+			OdaClob ret = newClobWrapper( clob );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, "IResultSet.getClob( String columnName )" );
+			return null;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return null;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return null;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+    }
+    
+    private OdaClob newClobWrapper( IClob clob )
+    {
+        return ( clob == null ) ? null : 
+		    new OdaClob( clob, getOdaConnection(), 
+		            switchContextClassloader(), getDriverClassLoader());
+    }
+
+	public boolean wasNull() throws OdaException
+	{
+	    final String context = "OdaResultSet.wasNull()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getResultSet().wasNull();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IResultSet.wasNull()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int findColumn( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.findColumn( " + columnName +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSet().findColumn( columnName );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSet.findColumn( String columnName )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	//---------------------------------------------------------------
+	// Utility methods to encapsulate logging usage.
+	
+	public String getBigDecimalAsString( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getBigDecimalAsString( " + index + 
+						 " )\t";
+		logMethodCalled( context );
+		
+		BigDecimal decimal = getBigDecimal( index );
+		String ret = ( decimal == null ) ? "" : decimal.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getBigDecimalAsString( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getBigDecimalAsString( " + columnName + 
+						 " )\t";
+		logMethodCalled( context );
+		
+		BigDecimal decimal = getBigDecimal( columnName );
+		String ret = ( decimal == null ) ? "" : decimal.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getDateAsString( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getDateAsString( " + index + " )\t";
+		logMethodCalled( context );
+		
+		Date date = getDate( index );
+		String ret = ( date == null ) ? "" : date.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getDateAsString( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getDateAsString( " + columnName + " )\t";
+		logMethodCalled( context );
+		
+		Date date = getDate( columnName );
+		String ret = ( date == null ) ? "" : date.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimeAsString( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTimeAsString( " + index + " )\t";
+		logMethodCalled( context );
+		
+		Time time = getTime( index );
+		String ret = ( time == null ) ? "" : time.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimeAsString( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTimeAsString( " + columnName + " )\t";
+		logMethodCalled( context );
+		
+		Time time = getTime( columnName );
+		String ret = ( time == null ) ? "" : time.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimestampAsString( int index ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTimestampAsString( " + index + 
+						 " )\t";
+		logMethodCalled( context );
+		
+		Timestamp timestamp = getTimestamp( index );
+		String ret = ( timestamp == null ) ? "" : timestamp.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	public String getTimestampAsString( String columnName ) throws OdaException
+	{
+	    final String context = "OdaResultSet.getTimestampAsString( " + columnName + 
+						 " )\t";
+		logMethodCalled( context );
+		
+		Timestamp timestamp = getTimestamp( columnName );
+		String ret = ( timestamp == null ) ? "" : timestamp.toString();
+		
+		logMethodExitWithReturn( context, ret );
+		return ret;
+	}
+	
+	/*
+	 * Convenience method for the C++ hosts to determine the interface of 
+	 * the result set handle.
+	 */
+	public String getInterfaceName()
+	{
+		return IResultSet.class.getName();
+	}
+    
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaResultSetMetaData.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaResultSetMetaData.java
new file mode 100644
index 0000000..ec50e6f
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaResultSetMetaData.java
@@ -0,0 +1,355 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import org.eclipse.datatools.connectivity.oda.IResultSetMetaData;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaResultSetMetaData is the Oda wrapper for result set metadata.
+ */
+public class OdaResultSetMetaData extends OdaDriverObject
+								  implements IResultSetMetaData
+{
+	protected OdaResultSetMetaData( IResultSetMetaData resultSetMetaData,
+									OdaConnection connection,
+									boolean switchContextClassloader,
+									ClassLoader driverClassLoader )
+	{
+		super( resultSetMetaData, connection, switchContextClassloader,
+			   driverClassLoader );	
+		
+		String context = "OdaResultSetMetaData.OdaResultSetMetaData( " +
+						 resultSetMetaData + ", " + connection + " )\t";
+		logMethodCalled( context );
+	}
+	
+	private IResultSetMetaData getResultSetMetaData()
+	{
+		return (IResultSetMetaData) getObject();
+	}
+	
+	//------------------------------------------------------------------	
+	//	IResultSetMetaData public interface methods
+	//------------------------------------------------------------------
+	
+	public int getColumnCount() throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getColumnCount()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSetMetaData().getColumnCount();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSetMetaData.getColumnCount()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getColumnName( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getColumnName( " +
+						 index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String ret = getResultSetMetaData().getColumnName( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IResultSetMetaData.getColumnName( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getColumnLabel( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getColumnLabel( " +
+						 index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String ret = getResultSetMetaData().getColumnLabel( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IResultSetMetaData.getColumnLabel( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getColumnType( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getColumnType( " +
+						 index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSetMetaData().getColumnType( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSetMetaData.getColumnType( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnTypeNull( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnTypeNull( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public String getColumnTypeName( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getColumnTypeName( " +
+						 index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			String ret = getResultSetMetaData().getColumnTypeName( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetEmptyString( uoException,
+														 "IResultSetMetaData.getColumnTypeName( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnEmptyString( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnEmptyString( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getColumnDisplayLength( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getColumnDisplayLength( " +
+						 index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSetMetaData().getColumnDisplayLength( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSetMetaData.getColumnDisplayLength( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getPrecision( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getPrecision( " +
+						 index + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSetMetaData().getPrecision( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSetMetaData.getPrecision( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnNegOne( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnNegOne( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int getScale( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.getScale( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSetMetaData().getScale( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IResultSetMetaData.getScale( int index )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnNegOne( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnNegOne( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int isNullable( int index ) throws OdaException
+	{
+		String context = "OdaResultSetMetaData.isNullable( " + index +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getResultSetMetaData().isNullable( index );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IResultSetMetaData.isNullable( int index )" );
+			return IResultSetMetaData.columnNullableUnknown;
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+			return IResultSetMetaData.columnNullableUnknown;
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+			return IResultSetMetaData.columnNullableUnknown;
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaRowSet.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaRowSet.java
new file mode 100644
index 0000000..3290b5a
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaRowSet.java
@@ -0,0 +1,708 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import java.math.BigDecimal;
+import java.sql.Date;
+import java.sql.Time;
+import java.sql.Timestamp;
+
+import org.eclipse.datatools.connectivity.oda.IParameterRowSet;
+import org.eclipse.datatools.connectivity.oda.OdaException;
+
+/**
+ * OdaRowSet is the Oda wrapper for rowsets.
+ */
+public class OdaRowSet extends OdaResultSet implements IParameterRowSet
+{
+	protected OdaRowSet( IParameterRowSet rowSet, OdaConnection connection,
+						 boolean switchContextClassloader,
+						 ClassLoader driverClassLoader )
+	{
+		super( rowSet, connection, switchContextClassloader,
+			   driverClassLoader );
+		
+		String context = "OdaRowSet.OdaRowSet( " + rowSet + ", " +
+						 connection + " )\t";
+		logMethodExitWithReturn( context, this );
+	}
+	
+	private IParameterRowSet getRowSet()
+	{
+		return (IParameterRowSet) getResultSet();
+	}
+
+	//------------------------------------------------------------------
+	//	IRowSet public interface methods
+	//------------------------------------------------------------------
+
+	public boolean absolute( int rowIndex ) throws OdaException
+	{
+		String context = "OdaRowSet.absolute( " + rowIndex +
+						 " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getRowSet().absolute( rowIndex );
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IRowSet.absolute( int rowIndex )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean previous() throws OdaException
+	{
+		String context = "OdaRowSet.previous()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getRowSet().previous();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IRowSet.previous()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int add() throws OdaException
+	{
+		String context = "OdaRowSet.add()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getRowSet().add();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IRowSet.add()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void clear() throws OdaException
+	{
+		String context = "OdaRowSet.clear()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().clear();
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.clear()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public boolean isEmpty() throws OdaException
+	{
+		String context = "OdaRowSet.isEmpty()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			boolean ret = getRowSet().isEmpty();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetFalse( uoException,
+												   "IRowSet.isEmpty()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnFalse( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnFalse( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public int size() throws OdaException
+	{
+		String context = "OdaRowSet.size()\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			int ret = getRowSet().size();
+			
+			logMethodExitWithReturn( context, ret );
+			return ret;
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			return handleUnsupportedOpAndRetZero( uoException,
+												  "IRowSet.size()" );
+		}
+		catch( RuntimeException rtException )
+		{
+			return handleErrorAndReturnZero( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			return handleErrorAndReturnZero( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setInt( int columnIndex, int value ) throws OdaException
+	{
+		String context = "OdaRowSet.setInt( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setInt( columnIndex, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setint( int columnIndex, int value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setInt( String columnName, int value ) throws OdaException
+	{
+		String context = "OdaRowSet.setInt( " + columnName + ", " +
+						 value + ")\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setInt( columnName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setInt( String columnName, int value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDouble( int columnIndex, double value ) throws OdaException
+	{
+		String context = "OdaRowSet.setDouble( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setDouble( columnIndex, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setDouble( int columnIndex, double value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDouble( String columnName, double value ) throws OdaException
+	{
+		String context = "OdaRowSet.setDouble( " + columnName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setDouble( columnName, value );		
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setDouble( String columnName, double value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setBigDecimal( int columnIndex, BigDecimal value ) throws OdaException
+	{
+		String context = "OdaRowSet.setBigDecimal( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setBigDecimal( columnIndex, value );
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setBigDecimal( int columnIndex, BigDecimal value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public void setBigDecimal( String columnName, BigDecimal value ) throws OdaException
+	{
+		String context = "OdaRowSet.setBigDecimal( " + columnName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setBigDecimal( columnName, value );
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setBigDecimal( String columnName, BigDecimal value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+	
+	public void setString( int columnIndex, String value ) throws OdaException
+	{
+		String context = "OdaRowSet.setString( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setString( columnIndex, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowset.setString( int columnIndex, String value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setString( String columnName, String value ) throws OdaException
+	{
+		String context = "OdaRowSet.setString( " + columnName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setString( columnName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException, 
+								 "IRowSet.setString( String columnName, String value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDate( int columnIndex, Date value ) throws OdaException
+	{
+		String context = "OdaRowSet.setDate( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setDate( columnIndex, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setDate( int columnIndex, Date value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setDate( String columnName, Date value ) throws OdaException
+	{
+		String context = "OdaRowSet.setDate( " + columnName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setDate( columnName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setDate( String columnName, Date value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTime( int columnIndex, Time value ) throws OdaException
+	{
+		String context = "OdaRowSet.setTime( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setTime( columnIndex, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setTime( int columnIndex, Time value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTime( String columnName, Time value ) throws OdaException
+	{
+		String context = "OdaRowSet.setTime( " + columnName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setTime( columnName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setTime( String columnName, Time value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTimestamp( int columnIndex, Timestamp value ) throws OdaException
+	{
+		String context = "OdaRowSet.setTimestamp( " + columnIndex + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setTimestamp( columnIndex, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setTimestamp( int columnIndex, Timestamp value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+
+	public void setTimestamp( String columnName, Timestamp value ) throws OdaException
+	{
+		String context = "OdaRowSet.setTimestamp( " + columnName + ", " +
+						 value + " )\t";
+		logMethodCalled( context );
+		
+		try
+		{
+			setContextClassloader();
+			
+			getRowSet().setTimestamp( columnName, value );
+			
+			logMethodExit( context );
+		}
+		catch( UnsupportedOperationException uoException )
+		{
+			handleUnsupportedOp( uoException,
+								 "IRowSet.setTimestamp( String columnName, Timestamp value )" );
+		}
+		catch( RuntimeException rtException )
+		{
+			handleError( rtException );
+		}
+		catch( OdaException odaException )
+		{
+			handleError( odaException );
+		}
+		finally
+		{
+			resetContextClassloader();
+		}
+	}
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaSortSpecHelper.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaSortSpecHelper.java
new file mode 100644
index 0000000..d4dd4cf
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/OdaSortSpecHelper.java
@@ -0,0 +1,120 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2005 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation  - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.helper;
+
+import org.eclipse.datatools.connectivity.oda.OdaException;
+import org.eclipse.datatools.connectivity.oda.SortSpec;
+
+/**
+ * OdaSortSpecHelper is a consumer helper for handling SortSpec. 
+ */
+public final class OdaSortSpecHelper
+{
+	private OdaSortSpecHelper()
+	{
+		// not meant to be instantiated
+	}
+	
+	/**
+	 * @deprecated	Replaced by {@link #addSortKey(OdaQuery, String, int)}
+	 */
+	public static void addSortKey( OdaQuery statement,
+								   String columnName,
+								   int sortOrder,
+								   String localeString ) throws OdaException
+    {
+		addSortKey( statement, columnName, sortOrder );
+    }
+	
+	/**
+	 * Adds a sort key on the specified column to the given query.
+	 * @param query		a query that retrieves the result set containing the 
+	 * 					specified column
+	 * @param columnName	the name of a result set column to apply 
+	 * 				dynamic sorting. The specified column should be one 
+	 * 				of the columns retrieved by the given query.
+	 * @param sortOrder represents the sorting order; one of sortAsc, sortDesc.
+	 * @throws OdaException
+	 */
+	public static void addSortKey( OdaQuery query,
+									String columnName,
+									int sortOrder ) throws OdaException
+	{
+		SortSpec sortSpec = query.getSortSpec();
+		if( sortSpec != null )
+		{
+			sortSpec.addSortKey( columnName, sortOrder );
+			return;
+		}
+
+		int sortMode = query.getDSMetaData().getSortMode();
+		sortSpec = new SortSpec( sortMode );
+		sortSpec.addSortKey( columnName, sortOrder );
+		query.setSortSpec( sortSpec );
+	}
+	
+	/**
+	 * @deprecated	Replaced by {@link #addSortKey(OdaAdvancedQuery, String, String, int)}
+	 */
+	public static void addSortKey( OdaAdvancedQuery statement,
+								   String resultSetName,
+								   String columnName,
+								   int sortOrder,
+								   String localeString ) throws OdaException
+	{
+		addSortKey( statement, resultSetName, columnName, sortOrder );
+	}
+	
+	/**
+	 * Adds a sort key on the specified result set column to the given query.
+	 * @param query		a query that retrieves the result set containing the 
+	 * 					specified column
+	 * @param resultSetName	the name that identifies one of the query's result sets
+	 * @param columnName	the name of a result set column to apply 
+	 * 				dynamic sorting. The specified column should be one 
+	 * 				of the columns in the given query's named result set
+	 * @param sortOrder represents the sorting order; one of sortAsc, sortDesc.
+	 * @throws OdaException
+	 */
+	public static void addSortKey( OdaAdvancedQuery query,
+								   String resultSetName,
+								   String columnName,
+								   int sortOrder ) throws OdaException
+	{
+		SortSpec sortSpec = query.getSortSpec( resultSetName );
+		if( sortSpec != null )
+		{
+			sortSpec.addSortKey( columnName, sortOrder );
+			return;
+		}
+		
+		int sortMode = query.getDSMetaData().getSortMode();
+		sortSpec = new SortSpec( sortMode );
+		sortSpec.addSortKey( columnName, sortOrder );
+		query.setSortSpec( resultSetName, sortSpec );
+	}
+	
+	public static void resetSortKeys( OdaQuery statement ) throws OdaException
+	{
+		statement.setSortSpec( null );
+	}
+	
+	public static void resetSortKeys( OdaAdvancedQuery statement,
+									  String resultSetName ) throws OdaException
+	{
+		statement.setSortSpec( resultSetName, null );
+	}
+
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/package.html b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/package.html
new file mode 100644
index 0000000..15c1308
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/helper/package.html
@@ -0,0 +1,34 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ *************************************************************************
+ * Copyright (c) 2004, 2006 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation - initial API and implementation
+ *  
+ *************************************************************************
+
+-->
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body bgcolor="white">
+
+[<b>Provisional</b>] An ODA consumer helper package that assists an ODA consumer application 
+to manage the diverse capabilities and behavior of individual ODA data drivers.
+<p>
+It implements the ODA run-time interfaces, and encapsulates the application logic to 
+manage the interaction between an ODA consumer and the 
+ODA providers.
+
+<!-- Put @see and @since tags down here. -->
+@since 3.0
+
+</body>
+</html>
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/Messages.java b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/Messages.java
new file mode 100644
index 0000000..fafce73
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/Messages.java
@@ -0,0 +1,47 @@
+/*
+ *************************************************************************
+ * Copyright (c) 2004, 2006 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation - initial API and implementation
+ *  
+ *************************************************************************
+ */
+
+package org.eclipse.datatools.connectivity.oda.consumer.nls;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS 
+{
+	private static final String BUNDLE_NAME = "org.eclipse.datatools.connectivity.oda.consumer.nls.messages"; //$NON-NLS-1$
+
+	private Messages() 
+	{}
+
+	static 
+	{
+		// initialize resource bundle
+		NLS.initializeMessages( BUNDLE_NAME, Messages.class );
+	}
+
+	public static String helper_cannotGetNamedResultsAfterExecuteQuery;
+	public static String helper_cannotSetParamBeforePrepare;
+	public static String helper_cannotGetParamBeforeExecute;
+	public static String helper_cannotGetParamMdBeforePrepare;
+	public static String helper_cannotSetSortSpecBeforePrepare;
+	public static String helper_maxConcurrentConnectionsReached;
+	public static String helper_connectionFailed;
+	public static String helper_cannotConstructConnectionFactory;
+	public static String helper_inadequatePermissionsForCompatibility;
+	public static String helper_connectionIsInactive;
+	public static String helper_maxConcurrentStatementsReached;
+	public static String helper_prepareFailed;
+	public static String helper_cannotGetResultSetMdBeforePrepare;
+	public static String helper_cannotExecuteBeforePrepare;
+
+}
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/messages.properties b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/messages.properties
new file mode 100644
index 0000000..7a2df09
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/messages.properties
@@ -0,0 +1,27 @@
+#
+#************************************************************************
+# Copyright (c) 2004, 2006 Actuate Corporation.
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Contributors:
+#  Actuate Corporation - initial API and implementation
+#  
+#************************************************************************
+#
+helper_cannotGetNamedResultsAfterExecuteQuery=Cannot get result sets by name after executeQuery() has been called.
+helper_cannotSetParamBeforePrepare=Cannot set input parameters before statement has been prepared.
+helper_cannotGetParamBeforeExecute=Cannot get output parameters before statement executes.
+helper_cannotGetParamMdBeforePrepare=Cannot get parameter metadata before statement has been prepared.
+helper_cannotSetSortSpecBeforePrepare=Cannot set the sort specification before the statement has been prepared.
+helper_maxConcurrentConnectionsReached=Maximum active concurrent connections reached.
+helper_connectionFailed=Unable to open connection.
+helper_cannotConstructConnectionFactory=Unable to create the ODA driver's connection factory.
+helper_inadequatePermissionsForCompatibility=Cannot provide backwards compatibility due to inadequate permissions.
+helper_connectionIsInactive=The established connection to the data source is not active.
+helper_maxConcurrentStatementsReached=Maximum active concurrent statements reached for this connection.
+helper_prepareFailed=Prepare failed.
+helper_cannotGetResultSetMdBeforePrepare=Cannot get result set metadata before statement has been prepared.
+helper_cannotExecuteBeforePrepare=Cannot execute the statement before statement has been prepared.
diff --git a/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/package.html b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/package.html
new file mode 100644
index 0000000..26f5b35
--- /dev/null
+++ b/plugins/org.eclipse.datatools.connectivity.oda.consumer/src/org/eclipse/datatools/connectivity/oda/consumer/nls/package.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ *************************************************************************
+ * Copyright (c) 2004, 2006 Actuate Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *  Actuate Corporation - initial API and implementation
+ *  
+ *************************************************************************
+
+-->
+<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</head>
+<body bgcolor="white">
+
+[<b>Non-API</b>] Contains internal implementation of internationalization and localization features.
+
+<!-- Put @see and @since tags down here. -->
+@since 3.0
+
+</body>
+</html>
