Help with: System.ArgumentException in IBM.Data.Informix.TypeMap.FromSqlType(SQL_TYPE sqlType)
Posted in 2012
A .NET developer hit System.ArgumentException ("unknown SQL type - 0") in IBM.Data.Informix.TypeMap.FromSqlType when binding a parameter marker inside DECRYPT_CHAR(field, ?) via the Informix SQLI .NET provider (CSDK 3.50/3.70); the provider couldn't determine the parameter's type, though the ODBC provider worked and hard-coding a literal avoided it. His workaround was wrapping the call in a stored procedure taking/returning varchar. Others suggested switching to the DRDA-based IBM.Data.DB2 driver (bundled with CSDK, needing a DBSERVERALIAS with drsoctcp/drtlitcp in sqlhosts); no fix for the Informix provider itself was reported.
Auto-generated by DrWatson from the posts below — may be imperfect; read the full thread.
Topics: Connectivity: ODBC / JDBC / .NET, Security, Permissions & Auditing
Hi all, i need help on this one, when i try this select from a .net application with the .Net Informix Provider i get the error show below: string sql = "SELECT DECRYPT_CHAR(field_encrypted, ?) AS field_decrypted" + " FROM some_table WHERE id = 48084"; using (DbCommand cmd = ds.GetCommand(sql)) { ds.AddParameter(cmd, "ope_tar_pan_dec", DbType.String, "somepassword"); using (IDataReader dr = cmd.ExecuteReader()) // <-- THROWS // cut the rest This fails at IBM.Data.Informix.TypeMap.FromSqlType(SQL_TYPE sqlType) apparently SQL_TYPE been 0 ? Message=Tipo de SQL desconocido - 0. --> translated is: SQL type unknow - 0. Im using csdk 3.70.TC3, was working with ODBC .net provider before, full detail: System.ArgumentException was unhandled Message=Tipo de SQL desconocido - 0. Source=IBM.Data.Informix StackTrace: en IBM.Data.Informix.TypeMap.FromSqlType(SQL_TYPE sqlType) en IBM.Data.Informix.IfxParameter.Bind(IfxDataReader tmpReader, IntPtr stmt, IfxCommand parent, Int16 ordinal, CNativeBuffer valueBuffer, CNativeBuffer lenIndBuffer) en IBM.Data.Informix.IfxCommand.ExecuteReaderObject(CommandBehavior behavior, String method) en IBM.Data.Informix.IfxCommand.ExecuteReader(CommandBehavior behavior) en IBM.Data.Informix.IfxCommand.ExecuteDbDataReader(CommandBehavior behavior) en System.Data.Common.DbCommand.ExecuteReader() en IT.Data.DataSession.ExecuteReader(DbCommand cmd) en C: \\Proyectos\\DotNet\\TFS\\IT\\IT.Data\\IT.Data\\DataSession.cs:línea 310 en IT.Data.DataSession.GetRecord(DbCommand cmd) en C:\\Proyectos \\DotNet\\TFS\\IT\\IT.Data\\IT.Data\\DataSession.cs:línea 479 en DataEnc.Program.Main(String[] args) en C:\\Proyectos\\DotNet \\SandBox\\DataEnc\\DataEnc\\Program.cs:línea 31 en System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) en System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) en Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() en System.Threading.ThreadHelper.ThreadStart_Context(Object state) en System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) en System.Threading.ThreadHelper.ThreadStart() InnerException: Help!!! Enrique
Have found that the problem is to determine the TYPE of the first DbCommand parameter, the first ?, if i use a constant value concatenated in the string problem goes away. Still my workaround is to create a stored procedure that receives the varchars and return varchar so i can keep using parameters. Yet, ugly bug. isnt there in ODBC provider. > > string sql = "SELECT DECRYPT_CHAR(field_encrypted, ?) <-- this ? apparently cant be resolved as SQL_TYPE and .Bind method fails. > AS field_decrypted" + > " FROM some_table WHERE id = 48084"; > snip.
Is this the Informix SQLI driver or the "Universal" DRDA driver? Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Tue, Jan 3, 2012 at 9:00 AM, eferreyra <eferreyra@gmail.com> wrote: > Have found that the problem is to determine the TYPE of the first > DbCommand parameter, the first ?, if i use a constant value > concatenated in the string problem goes away. > > Still my workaround is to create a stored procedure that receives the > varchars and return varchar so i can keep using parameters. > > Yet, ugly bug. isnt there in ODBC provider. > > > > > string sql = "SELECT DECRYPT_CHAR(field_encrypted, ?) <-- this ? > apparently cant be resolved as SQL_TYPE and .Bind method fails. > > AS field_decrypted" + > > " FROM some_table WHERE id = 48084"; > > snip. > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list >
Hi Art. Informix SQLI driver IBM Informix Client SDK 3.50.TC4DE (same problem with 3.70.TC3.WIN) On 3 ene, 11:39, Art Kagel <art.ka...@gmail.com> wrote: > Is this the Informix SQLI driver or the "Universal" DRDA driver? > > Art > > Art S. Kagel > Advanced DataTools (www.advancedatatools.com) > Blog:http://informix-myview.blogspot.com/ > > Disclaimer: Please keep in mind that my own opinions are my own opinions > and do not reflect on my employer, Advanced DataTools, the IIUG, nor any > other organization with which I am associated either explicitly, > implicitly, or by inference. Neither do those opinions reflect those of > other individuals affiliated with any entity with which I am affiliated nor > those of the entities themselves. > > > > > > > > On Tue, Jan 3, 2012 at 9:00 AM, eferreyra <eferre...@gmail.com> wrote: > > Have found that the problem is to determine the TYPE of the first > > DbCommand parameter, the first ?, if i use a constant value > > concatenated in the string problem goes away. > > > Still my workaround is to create a stored procedure that receives the > > varchars and return varchar so i can keep using parameters. > > > Yet, ugly bug. isnt there in ODBC provider. > > > > string sql = "SELECT DECRYPT_CHAR(field_encrypted, ?) <-- this ? > > apparently cant be resolved as SQL_TYPE and .Bind method fails. > > > AS field_decrypted" + > > > " FROM some_table WHERE id = 48084"; > > > snip. > > _______________________________________________ > > Informix-list mailing list > > Informix-l...@iiug.org > >http://www.iiug.org/mailman/listinfo/informix-list
Try the DRDA driver, it tends to be faster for .NET and the .NET feature support is a bit better also. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Tue, Jan 3, 2012 at 10:19 AM, eferreyra <eferreyra@gmail.com> wrote: > Hi Art. > > Informix SQLI driver > > IBM Informix Client SDK 3.50.TC4DE (same problem with 3.70.TC3.WIN) > > > > On 3 ene, 11:39, Art Kagel <art.ka...@gmail.com> wrote: > > Is this the Informix SQLI driver or the "Universal" DRDA driver? > > > > Art > > > > Art S. Kagel > > Advanced DataTools (www.advancedatatools.com) > > Blog:http://informix-myview.blogspot.com/ > > > > Disclaimer: Please keep in mind that my own opinions are my own opinions > > and do not reflect on my employer, Advanced DataTools, the IIUG, nor any > > other organization with which I am associated either explicitly, > > implicitly, or by inference. Neither do those opinions reflect those of > > other individuals affiliated with any entity with which I am affiliated > nor > > those of the entities themselves. > > > > > > > > > > > > > > > > On Tue, Jan 3, 2012 at 9:00 AM, eferreyra <eferre...@gmail.com> wrote: > > > Have found that the problem is to determine the TYPE of the first > > > DbCommand parameter, the first ?, if i use a constant value > > > concatenated in the string problem goes away. > > > > > Still my workaround is to create a stored procedure that receives the > > > varchars and return varchar so i can keep using parameters. > > > > > Yet, ugly bug. isnt there in ODBC provider. > > > > > > string sql = "SELECT DECRYPT_CHAR(field_encrypted, ?) <-- this ? > > > apparently cant be resolved as SQL_TYPE and .Bind method fails. > > > > AS field_decrypted" + > > > > " FROM some_table WHERE id = 48084"; > > > > snip. > > > _______________________________________________ > > > Informix-list mailing list > > > Informix-l...@iiug.org > > >http://www.iiug.org/mailman/listinfo/informix-list > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list >
Its downloadable from IBM ? Anyway sp solution better for now, we have a lot of servers and clients using Connect/CSDK still could test it in some server. I once try one that was a lot of DB2 stuff and override my Informix CSDK with old drivers, i hope isnt that one... Thanks Art.
The DRDA drivers now come packaged along with CSDK. It is referred to as 'IBM Data Server Driver Package'. If you are using CSDK 3.50xC6 or later OR any version of CSDK 3.70 you must find it as part of the package. Yes, the driver I was referring to is in the IBM.Data.DB2 namepsace. All of the classes and functions might have a DB2 prefix, however this is the recommended driver for new application development against Informix. Do feel free to reach out if you need further assistance/help on this issue. Thanks! Regards, Raj "Setting an example is not the main means of influencing another, it is the only means." --Albert Einstein From: eferreyra <eferreyra@gmail.com> To: informix-list@iiug.org Date: 01/03/2012 10:20 PM Subject: Re: Help with: System.ArgumentException in IBM.Data.Informix.TypeMap.FromSqlType(SQL_TYPE sqlType) Sent by: informix-list-bounces@iiug.org Its downloadable from IBM ? Anyway sp solution better for now, we have a lot of servers and clients using Connect/CSDK still could test it in some server. I once try one that was a lot of DB2 stuff and override my Informix CSDK with old drivers, i hope isnt that one... Thanks Art. _______________________________________________ Informix-list mailing list Informix-list@iiug.org http://www.iiug.org/mailman/listinfo/informix-list
Thanks Raj, i was using 3.70 until i unistall to try 3.50 and see if problem goes away, buy yet in both always using IBM.Data.Informix provider. Questions: with this driver and DRDA protocol: Is other provider ? what is his name ? there is any pdf with the reference ? I have: IBM Informix .NET Provider Reference Guide 30.pdf There is anything to change in the server to suport DRDA or it comes built in and working ? (IDS 11.5x and later) There is any technical pdf about DRDA ? This fixes the issues of adding the provider to the several machine.configs of different frameworks? It still comes with ODBC driver named: IBM INFORMIX ODBC DRIVER ? can we make the ODBC driver work with DRDA ? Thanks, ill start another thread with more questions. Enrique
DRDA client support is built into the engine, you just have to define a new DBSERVERALIAS for that connection protoco, put an entry for it in the sqlhosts file using drtlitcp or drsoctcp as appropriate for your platform, and bounce the engine. Art Art S. Kagel Advanced DataTools (www.advancedatatools.com) Blog: http://informix-myview.blogspot.com/ Disclaimer: Please keep in mind that my own opinions are my own opinions and do not reflect on my employer, Advanced DataTools, the IIUG, nor any other organization with which I am associated either explicitly, implicitly, or by inference. Neither do those opinions reflect those of other individuals affiliated with any entity with which I am affiliated nor those of the entities themselves. On Wed, Jan 4, 2012 at 6:31 AM, eferreyra <eferreyra@gmail.com> wrote: > Thanks Raj, i was using 3.70 until i unistall to try 3.50 and see if > problem goes away, buy yet in both always using IBM.Data.Informix > provider. > > Questions: with this driver and DRDA protocol: > > Is other provider ? what is his name ? there is any pdf with the > reference ? > I have: IBM Informix .NET Provider Reference Guide 30.pdf > > There is anything to change in the server to suport DRDA or it comes > built in and working ? (IDS 11.5x and later) > There is any technical pdf about DRDA ? > > This fixes the issues of adding the provider to the several > machine.configs of different frameworks? > > It still comes with ODBC driver named: IBM INFORMIX ODBC DRIVER ? can > we make the ODBC driver work with DRDA ? > > Thanks, ill start another thread with more questions. > > Enrique > > _______________________________________________ > Informix-list mailing list > Informix-list@iiug.org > http://www.iiug.org/mailman/listinfo/informix-list >