[Mono-bugs] [Bug 74917][Maj] New - OdbcParameters not working in Mono 1.1.7
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Thu, 12 May 2005 04:43:59 -0400 (EDT)
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by dfreund@runlevel-5.org.
http://bugzilla.ximian.com/show_bug.cgi?id=74917
--- shadow/74917 2005-05-12 04:43:59.000000000 -0400
+++ shadow/74917.tmp.1809 2005-05-12 04:43:59.000000000 -0400
@@ -0,0 +1,145 @@
+Bug#: 74917
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dfreund@runlevel-5.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: OdbcParameters not working in Mono 1.1.7
+
+Description of Problem:
+Building queries using OdbcParameter does not work on Mono 1.1.7. It gives
+no results running under Mono/Windows and a UnhandledException running
+under Linux/Mono
+It does neither work on Linux (SLES9) nor WinXP (testet it with Pacos 1.1.7
+Installer).
+I can reproduce the problem with Firebird and Informix but I think this is
+a general Problem that is not database dependent
+My test program only fails with Mono. I get the expected results when using
+MS .Net
+
+Steps to reproduce the problem:
+1.
+Create a test table e.g. in firebird and give it some data:
+
+CREATE TABLE T_ODBC_TEST (
+ ID SMALLINT NOT NULL,
+ LAST_NAME VARCHAR(20),
+ FIRST_NAME CHAR(20)
+);
+
+INSERT INTO T_ODBC_TEST (ID, LAST_NAME, FIRST_NAME) VALUES (1, 'Dent',
+'Arthur');
+INSERT INTO T_ODBC_TEST (ID, LAST_NAME, FIRST_NAME) VALUES (2, 'Prefect',
+'Ford');
+
+BTW.: I use Firebird 1.5 and ODBC driver 1.2.1 from the ibphonix.com
+download page
+
+2.
+Create a test program and compile it:
+
+using System;
+using System.Data;
+using System.Data.Odbc;
+using System.Text;
+
+class MainClass
+{
+ const string DB_CONN =
+ "DRIVER=Firebird/InterBase(r)
+driver;UID=sysdba;PWD=masterkey;DBNAME=127.0.0.1:d:/db/TEST.FDB";
+
+ public static void Main(string[] args)
+ {
+ Console.WriteLine("act. DSN: " + DB_CONN);
+ using (OdbcConnection conn = new OdbcConnection(DB_CONN))
+ {
+ conn.Open();
+
+ // query without parameters works
+ OdbcCommand cmdOk = conn.CreateCommand();
+ cmdOk.CommandText = "SELECT * FROM t_odbc_test";
+ OdbcDataReader readerOk = cmdOk.ExecuteReader();
+
+ while (readerOk.Read())
+ Console.WriteLine("--> " + readerOk["LAST_NAME"]);
+
+ readerOk.Close();
+
+
+ Console.WriteLine("------------------------------------------");
+
+ // query with parameters fail
+ OdbcCommand cmdFail = conn.CreateCommand();
+ cmdFail.CommandText = "SELECT * FROM t_odbc_test WHERE last_name = ?";
+
+ cmdFail.Parameters.Add("P1", OdbcType.VarChar);
+ cmdFail.Parameters["P1"].Value = "Dent";
+
+ OdbcDataReader readerFail = cmdFail.ExecuteReader();
+
+ while (readerFail.Read())
+ Console.WriteLine("--> " + readerFail["LAST_NAME"]);
+
+ readerFail.Close();
+ Console.WriteLine("------------------------------------------");
+ }
+ }
+}
+
+Compile with mcs -r:System.Data Main.cs
+
+3.
+Start after compiling using mono with
+mono Main.exe
+
+
+Actual Results:
+--> Dent
+--> Prefect
+------------------------------------------
+------------------------------------------
+
+Expected Results:
+--> Dent
+--> Prefect
+------------------------------------------
+--> Dent
+------------------------------------------
+
+Calling Main.exe directly (using MS.NET) will give the expected result
+
+How often does this happen?
+every time
+
+Additional Information:
+Running under Mono/Windows/Firebird returns just no result.
+
+Running under Mono/Linux/Informix returns the following stack trace:
+
+Unhandled Exception: System.Data.Odbc.OdbcException:
+[unixODBC][Informix][Informix ODBC Driver]Unspecified System Error = -21000.
+in <0x00128> System.Data.Odbc.OdbcCommand:ExecSQL (System.String sql)
+in (wrapper remoting-invoke-with-check)
+System.Data.Odbc.OdbcCommand:ExecSQL (string)
+in <0x00076> System.Data.Odbc.OdbcCommand:ExecuteNonQuery (Boolean freeHandle)
+in (wrapper remoting-invoke-with-check)
+System.Data.Odbc.OdbcCommand:ExecuteNonQuery (bool)
+in <0x00015> System.Data.Odbc.OdbcCommand:ExecuteReader (CommandBehavior
+behavior)
+in (wrapper remoting-invoke-with-check)
+System.Data.Odbc.OdbcCommand:ExecuteReader (System.Data.CommandBehavior)
+in <0x0000f> System.Data.Odbc.OdbcCommand:ExecuteReader ()
+in (wrapper remoting-invoke-with-check)
+System.Data.Odbc.OdbcCommand:ExecuteReader ()
+in <0x0016a> MainClass:Main (System.String[] args)