runtime: System.Data.Odbc bug for connect IRISDB through odbc for unixodbc

Description

When i try to using System.Data.Odbc to connect the irisdb thought odbc to do some select sql , it give a error for that. and when i using isql to do the same sql , it return right result

Reproduction Steps

1 to install the IRISDB(https://docs.intersystems.com/iris20222/csp/docbook/DocBook.UI.Page.cls) 2 write this code

        public DataSet exeSqlForDataSet(string queryString)
        {
            try
            {
                  string MysqlString = "DSN=iris;UID=_system;pwd=sys";//"DSN=kingbase;" +
                                      //      "UID=Admin;" +
                                        //    "pwd=Passw0rd";

                  OdbcConnection conn; = new OdbcConnection(MysqlString); //数据库连接 
                //CLogger._log.Debug(QueryString);
                if (conn.State != ConnectionState.Open)
                {
                    conn.Open();
                }

                queryString = queryString.Replace('\r', ' ').Replace('\n', ' ');

                var cmd = new OdbcCommand();
                cmd.Connection = this.conn;
                if (inTransaction)
                    cmd.Transaction = trans;
                DataSet ds = new DataSet();
                var ad = new OdbcDataAdapter();
                cmd.CommandText = queryString;
                //CLogger._log.Debug(QueryString);
                ad.SelectCommand = cmd;
                ad.Fill(ds);
                return ds;
            }
            catch (Exception e2)
            {
                throw e2;
            }
        }

3 when you exec this fun for a sql , it will throw the Exception for that something is not valid

Expected behavior

return the result for that sql

Actual behavior

throw exception System.FormatException: Input string was not in a correct format.

Regression?

No response

Known Workarounds

No response

Configuration

the dotnet is dotnet5 system.data.odbc version is 5

Other information

No response

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 15 (7 by maintainers)

Most upvoted comments

@roji or someone in his team will have to answer that as it’s not my area.

i only find this error in this db , the other db that using this nuget return the true data, do you need to download that db to make some test ?

Yes - we need to be able to fully reproduce the exception in order to investigate further. The link you provided above seems to be a driver installation help page, and I’m still not clear whether you’re able to successfully connect to a different database (with the same driver!), or successfully connect to the problematic database with a different driver (i.e. from another language).

BTW I noticed on the driver download page that there’s an ADO.NET driver - this could be a better option than ODBC. You may want to give that a try.

@1009058470 can you please include the full exception, including its stack trace?