I am getting below error while I trying to open db2 connection

ERROR [HY011] [IBM][CLI Driver] CLI0126E Operation invalid at this time. SQLSTATE=HY011



Code :

public class DB2Access
{
OdbcConnection connection = null;

//List<OdbcConnection> connObject;

public DB2Access()
{

}

//public List<OdbcConnection> getConnectionList()
//{
// return connObject;
//}

public void DB2Update(SortedList sqlHT, string subsystem)
{

//OdbcConnection connection=null;
//if (connObject == null)
//{
//List<OdbcConnection connObject = new List<OdbcConnection>();
//}
try
{
connection = new OdbcConnection(GetConnectionString(subsystem));
OpenDB2Connection(connection);
//connObject.Add(connection);
IDictionaryEnumerator enmeratorFE = sqlHT.GetEnumerator();
while (enmeratorFE.MoveNext())
{
ArrayList sqlAL = (ArrayList)enmeratorFE.Value;
bool throwException=false;
OdbcCommand cmd = connection.CreateCommand();
cmd.CommandText = (string)sqlAL[0];
throwException = (bool)sqlAL[1];
int intCmdResult = cmd.ExecuteNonQuery();
if (throwException)
{
if (intCmdResult == 0)
throw new Exception("Host Update Failed");
}
}
}
catch (Exception e)
{
throw e;
}
finally
{
//CloseDB2Connection(connection);
}
}

public static void OpenDB2Connection(OdbcConnection conn)
{
TcimDataAccessException tcimDataAccessException;
try
{
conn.Open();
}
catch (InvalidOperationException e)
{
tcimDataAccessException = new TcimDataAccessException(TcimErrorSeverity.Fatal, e.Message);
tcimDataAccessException.SetStackTrace(e.StackTrace );
throw tcimDataAccessException;
}
catch (Exception e)
{
tcimDataAccessException = new TcimDataAccessException(e);
tcimDataAccessException.SetStackTrace(e.StackTrace );
throw tcimDataAccessException;
}
}