× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I'm looking at the ADO provider version 10 from V5R4 in Reflector...

Have you verified the integrity of the three fields in question after
the exception is getting thrown?

Are you explicitly calling
IBM.Data.DB2.iSeries.iDB2Command.DeriveParameters() inside
DataHelper.Data.ExecuteDataset() function or are you using
iDB2CommandBuilder in ExecuteDataset()?

MapSQLTypeToiDB2DbType does a switch on the types variable:

DcSqlTypes types = NormalizeSqlType(sqlType);

internal static DcSqlTypes NormalizeSqlType(DcSqlTypes sqlType)
{
return (DcSqlTypes) ((short) (sqlType & ((DcSqlTypes) 0xfffe)));
}

internal enum DcSqlTypes : short
{
xCWBDC_SQLBigInt = 0x1ec,
CWBDC_SQLBigIntNC = 0x1ed,
xCWBDC_SQLBinary = 0x390,
CWBDC_SQLBinaryNC = 0x391,
xCWBDC_SQLBLOB = 0x194,
xCWBDC_SQLBLOBLocator = 960,
CWBDC_SQLBLOBLocatorNC = 0x3c1,
CWBDC_SQLBLOBNC = 0x195,
CWBDC_SQLCLOB = 0x198,
xCWBDC_SQLCLOBLocator = 0x3c4,
xCWBDC_SQLCLOBLocatorNC = 0x3c5,
CWBDC_SQLCLOBNC = 0x199,
xCWBDC_SQLDate = 0x180,
CWBDC_SQLDateNC = 0x181,
CWBDC_SQLDBCLOB = 0x19c,
CWBDC_SQLDBCLOBLocator = 0x3c8,
CWBDC_SQLDBCLOBLocatorNC = 0x3c9,
CWBDC_SQLDBCLOBNC = 0x19d,
xCWBDC_SQLFloat = 480,
CWBDC_SQLFloatNC = 0x1e1,
xCWBDC_SQLGraphic = 0x1d4,
CWBDC_SQLGraphicNC = 0x1d5,
CWBDC_SQLInvalidType = 8,
xCWBDC_SQLLargeInt = 0x1f0,
CWBDC_SQLLargeIntNC = 0x1f1,
xCWBDC_SQLLongVaryingGraphic = 0x1d8,
CWBDC_SQLLongVaryingGraphicNC = 0x1d9,
xCWBDC_SQLLongVaryingString = 0x1c8,
CWBDC_SQLLongVaryingStringNC = 0x1c9,
CWBDC_SQLNullCapable = 1,
xCWBDC_SQLPacked = 0x1e4,
CWBDC_SQLPackedNC = 0x1e5,
xCWBDC_SQLRowId = 0x388,
CWBDC_SQLRowIdNC = 0x389,
xCWBDC_SQLSmallInt = 500,
CWBDC_SQLSmallIntNC = 0x1f5,
xCWBDC_SQLString = 0x1c4,
CWBDC_SQLStringNC = 0x1c5,
xCWBDC_SQLTime = 0x184,
CWBDC_SQLTimeNC = 0x185,
xCWBDC_SQLTimeStamp = 0x188,
CWBDC_SQLTimeStampNC = 0x189,
CWBDC_SQLVarDataLink = 0x18c,
CWBDC_SQLVarDataLinkNC = 0x18d,
xCWBDC_SQLVaryingBinary = 0x38c,
CWBDC_SQLVaryingBinaryNC = 0x38d,
xCWBDC_SQLVaryingGraphic = 0x1d0,
CWBDC_SQLVaryingGraphicNC = 0x1d1,
xCWBDC_SQLVaryingString = 0x1c0,
CWBDC_SQLVaryingStringNC = 0x1c1,
xCWBDC_SQLZoned = 0x1e8,
CWBDC_SQLZonedNC = 0x1e9
}


Looks like the switch doesn't support all possible cases in the
DcSqlTypes enum.

Take a look on pg 70 of
http://www.redbooks.ibm.com/abstracts/sg246440.html. Can you write a
custom logger to determine what is being passed to
MapSQLTypeToiDB2DBtype? See DeriveParameters() in iDB2Command:

iDB2Parameter parameter = this.m_Parameters.Add(new
iDB2Parameter(paramName,
iDB2DbTypeUtility.MapSQLTypeToiDB2DbType(this.m_paramColInfo[j].m_sqlTyp
e, (int) this.m_paramColInfo[j].m_ccsid,
this.m_paramColInfo[j].m_length)));



-chris


-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Walden H. Leverich
Sent: Monday, September 21, 2009 8:40 AM
To: Midrange Systems Technical Discussion
Subject: Occasional .Net InvalidCastException from w/in
MapSQLTypeToiDB2DbType

We have an ASP.Net (C#) application that occasionally (as in we're fine
for weeks, and then it will happen) will start to throw an
InvalidCastException (stack trace below). We've tried Googling the
MapSQLTypeToiDB2DbType and there are no hits. Anyone seen this error
happen? Any ideas on how to fix? It's on a simple select statement
selecting 3 columns from a table, a char, a decimal, and a char column,
and the code runs w/out a problem most of the time. It's as if the i is
returning different meta data for one of those columns at some point.
Once it starts we need to kill the asp.net process to get it fixed.



-Walden



[InvalidCastException: The data type returned is currently not supported
by the provider.]

IBM.Data.DB2.iSeries.iDB2DbTypeUtility.MapSQLTypeToiDB2DbType(DcSqlTypes
sqlType, Int32 colccsid, UInt32 length) +779
IBM.Data.DB2.iSeries.iDB2Command.DeriveParameters() +778
DataHelper.Data.ExecuteDataset(String commandText, CommandType
commandType, Object[] parameters) in
E:\dev\Condor\PaymentSite\Data\Data.cs:119
DataHelper.Data.ExecuteDataRowInternal(String commandText,
CommandType commandType, Boolean ThrowOnError, Object[] parameters) in
E:\dev\Condor\PaymentSite\Data\Data.cs:75
DataHelper.Data.ExecuteDataRow(String commandText, CommandType
commandType, Object[] parameters) in
E:\dev\Condor\PaymentSite\Data\Data.cs:60
BusinessObjects.PaymentRequest.GetPaymentRequest(Guid
paymentRequestGuid) in
E:\dev\Condor\PaymentSite\BusinessObjects\PaymentRequest.cs:44
CSRPayments.ProcessPayment.Page_Load(Object sender, EventArgs e) in
E:\dev\Condor\PaymentSite\CSRPayments\ProcessPayment.aspx.cs:23
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object
o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object
sender, EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47

System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
+1061





As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.