Answered by:
Getting an error while using ODBC to execute a DB2 database stored procedure from Script Task in SSIS 2012

Question
-
I'm trying to execute a script task that runs a stored procedure with parameters on a DB2 machine.
It connects just fine but I get an error when executing saying that it "Failed to convert parameter value from a DateTime to a Byte[]."
I have to input parameters of type OdbcType.Timestamp that seem to be the culprits.
OdbcConnection Connection; OdbcCommand command; string strConnection; Connection = new OdbcConnection(strConnection); command = new OdbcCommand("StoredProcName", Connection); command.CommandType = CommandType.StoredProcedure; command.Parameters.Add("CSE_ENT_TMS", OdbcType.Timestamp); command.Parameters["CSE_ENT_TMS"].Value = Dts.Variables["User::EnteredTime"].Value; command.Parameters.Add("CSE_LST_MNT_TMS", OdbcType.Timestamp); command.Parameters["CSE_LST_MNT_TMS"].Value = Dts.Variables["User::LastMaintTMS"].Value;
I've searched the internet to find a way that works to make the C# DateTime variables compatible with the ODBC timestamp bu to no avail. Changing to OdbcType.DateTime generates a different error:
ERROR [42601] [IBM][CLI Driver][DB2] SQL0104N An unexpected token "FRDINST3150TRANS" was found following "". Expected tokens may include: "<ERR_STMT> <WNG_STMT> GET SQL SAVEPOINT HOLD FREE AS". SQLSTATE=42601
Any ideas?
Answers
-
Thanks for the replies. What I ended up doing it switching to OLEDB and using the DBTimestamp type. It works fine now!
- Marked as answer by Mike M. - Portland Tuesday, December 15, 2015 6:56 PM
All replies
-
-
Thanks for the replies. What I ended up doing it switching to OLEDB and using the DBTimestamp type. It works fine now!
- Marked as answer by Mike M. - Portland Tuesday, December 15, 2015 6:56 PM
-