× 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.



Another cool thing we could do is write a custom logger to capture the
data inside of iDb2Command's private fields after a Prepare() call,
before calling DeriveParameters(). We could even play around with the
unmanaged cwbxxx library calls.

http://msdn.microsoft.com/en-us/library/system.reflection.fieldinfo.aspx

Then we'd have all the info we need to determine why DeriveParameters()
is failing.

Let me know if you want to do this.

// iDB2Command Fields
private int m_blockRowCount;
internal int m_BlockSize;
private string m_CmdText;
private int m_CmdTimeout;
internal bool m_commandContainsReturnValueParam;
internal bool m_commandIsCall;
private CommandType m_CommandType;
private iDB2Connection m_Connection;
internal int m_currentResultSet;
private bool m_cursorOpen;
private IntPtr m_dcConnHandle;
internal MpDcFetch m_dcFetch;
internal IntPtr m_dcRequest;
internal IntPtr m_dcResultData;
private bool m_Disposed;
internal bool m_HasRows;
internal MPHostColInfo m_hostColInfo;
private string m_iSeriesCmdText;
internal bool m_needToPrepare;
internal MPHostColInfo m_paramColInfo;
private iDB2ParameterCollection m_Parameters;
private string m_preparedSQLStmt;
private int m_recordsAffected;
internal uint m_resultSets;
internal string m_returnValueParameterName;
internal int m_rowsReturned;
private iDB2Transaction m_Transaction;
private UpdateRowSource m_UpdatedRowSource;



-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of ibm
Sent: Monday, September 21, 2009 2:00 PM
To: Midrange Systems Technical Discussion
Subject: RE: Occasional .Net
InvalidCastExceptionfromw/inMapSQLTypeToiDB2DbType

Another thought,

Inside Prepare() if parameterInfo !=0 then parameterInfo is tested
against 0x7d00 through 0x7d63. If the value falls between those numbers
then you're never notified unless tracing is on.

Some of these possible "warnings" look pretty serious and vague to me:

internal static bool isHostWarning(int rc)
{
return ((rc >= 0x7d00) && (rc < 0x7d64));
}


CWBDC_CAT_PARAMETER_WARNING = 0x7d07,
CWBDC_CAT_WARNING = 0x7d06,
CWBDC_END_OF_DATA = 0x7d00,
CWBDC_EXIT_PROGRAM_WARNING = 0x7d0b,
CWBDC_GENERAL_SERVER_WARNING = 0x7d0a,
CWBDC_HOST_ERROR_START = 0x7d64,
CWBDC_HOST_WARN_START = 0x7d00,
CWBDC_MTS_WARNING = 0x7d0c,
CWBDC_NDB_LIBRARY_NOT_ADDED = 0x7d0d,
CWBDC_NDB_PARAMETER_WARNING = 0x7d09,
CWBDC_NDB_WARNING = 0x7d08,
CWBDC_NEXT_END_OF_DATA = 0x7d01,
CWBDC_NO_DATA_RETURNED = 0x7d02,
CWBDC_PACKAGE_EXISTS = 0x7d03,
CWBDC_SQL_PARAMETER_WARNING = 0x7d05,
CWBDC_SQL_WARNING = 0x7d04,

I think this as deep as we can get w/o a trace on the provider.

-chris

-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of ibm
Sent: Monday, September 21, 2009 1:22 PM
To: Midrange Systems Technical Discussion
Subject: RE: Occasional .Net
InvalidCastExceptionfromw/inMapSQLTypeToiDB2DbType

In Prepare() calls to verifyConnection() and createRequest() both
succeed since you're not throwing anything in there. But createRequest
calls

[DllImport("cwbdc.dll", EntryPoint="#502",
CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
private static extern int DcDnCreateRequest(int functionNumber, IntPtr
connectionHandle, ref MpDcCreateRequest parms);

So , lets assume that inside Prepare() createRequest() returns
iDB2Command.m_dcRequest != IntPtr.Zero and createSQLForiSeries() does
return and now the param collection count = 1. Looks like

[DllImport("cwbdc.dll", EntryPoint="#503",
CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
private static extern int DcDnPrepare(int functionNumber, IntPtr
requestHandle, ref MpDcPrepare parms, IntPtr p);

is ok since you're not throwing iDB2DCFunctionErrorException.

Now, if (parameterInfo !=0) then you'll only be made aware of a
"warning" if tracing is on, if the RC is an error code then you'll be
throwing and exception here.

So, (parms.parameterCount = 1) so we move on and create a infoArray of
MpDcHostColumnInfo type. No problem.

Then we call GetParameterInfo with the pointer we got from
createRequest. It succeeds since you're not throwing an exception here.
parameterInfo must be = 0 since we're not throwing anything here either.

If m_paramColInfo == null then we create a new MPHostColInfo. Something
we already did back in createSQLforiSeries based on ? parameter marker.

Then we updateHostColumnInfo with the infoArray which we retrieved
earlier... Here is where we actually set the m_sqlType, m_ccsid and
m_length that we will later use inside DeriveParameters(). Keep in mind
infoArray came from unmanaged code.

Then there is another check for parms.rsColumnCount > 0. I can't find
any code that sets rsColumnCount, so I'm assuming we skip it.

Finally the m_preparedSQLStmt is set to m_cmdtext or "SELECT Loan,
CSRUserId, namefornewcard FROM PaymentRequest WHERE PaymentRequestGuid =
?" in your case. Based on CommandType.Text.

So that's it for Prepare()...

Meanwhile back in DeriveParameters() we have m_paramColInfo != null,
yes. So now we iterate through your params:

ParamName is irrelevant, then we get a IDB2Parameter:

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)));

This is where we crap out. So, since we've gone this far I figure you
need to ask this guy >>>>

[DllImport("cwbdc.dll", EntryPoint="#503",
CallingConvention=CallingConvention.StdCall, CharSet=CharSet.Unicode)]
private static extern int DcDnGetParameterInfo(int functionNumber,
IntPtr requestHandle, [Out] MpDcHostColumnInfo[] parms, IntPtr p);

why its returning an item in the DcSqlTypes enum that
MapSQLTypeToiDB2DBType() can't switch on. Especially the
CWBDC_SQLInvalidType = 8 value.

-chris









-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Steve Richter
Sent: Monday, September 21, 2009 12:38 PM
To: Midrange Systems Technical Discussion
Subject: Re: Occasional .Net InvalidCastException
fromw/inMapSQLTypeToiDB2DbType

On Mon, Sep 21, 2009 at 11:46 AM, Walden H. Leverich
<WaldenL@xxxxxxxxxxxxxxx> wrote:


Look at the stack trace, it's blowing on the DeriveParameter call.
Seems
like i5/OS is returning invalid data. The PaymentRequestGuid is a
char(36) on the i. And we can go through this same code 1000s of times
w/out a problem and then it just screws up.

what about writing the data being returned by server to a temporary
trace file? The plan being to check this file everytime the PC side
bombs out to see if there is something in the data which is causing
the error.

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.