Need help with Linux ODBC Driver

classic Classic list List threaded Threaded
6 messages Options
Charles Rene Charles Rene
Reply | Threaded
Open this post in threaded view
|

Need help with Linux ODBC Driver

Hello,

I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver. I'm running a .Net Core 2.2 console application in a Linux environment in Docker.

The problem is that when I run a SELECT statement through .Net's System.Data.Odbc, I get back "bad data". It looks like a mismatch in encoding.

The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be "80579d98-9010-4610-b12e-ed33ed7d3c62".


Any idea what the problem might be?

Thank you,
Charlie
Igor Sapego Igor Sapego
Reply | Threaded
Open this post in threaded view
|

Re: Need help with Linux ODBC Driver

It seems like some encoding related issue to me.
Added a Jira ticket: [1].


Best Regards,
Igor


On Thu, May 2, 2019 at 1:15 AM Charles Rene <[hidden email]> wrote:
Hello,

I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver. I'm running a .Net Core 2.2 console application in a Linux environment in Docker.

The problem is that when I run a SELECT statement through .Net's System.Data.Odbc, I get back "bad data". It looks like a mismatch in encoding.

The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be "80579d98-9010-4610-b12e-ed33ed7d3c62".


Any idea what the problem might be?

Thank you,
Charlie
Charles Rene Charles Rene
Reply | Threaded
Open this post in threaded view
|

Re: Need help with Linux ODBC Driver

Thanks Igor. I also noticed that the Linux ODBC Driver deserializes the Ignite UUID data type into a byte[] instead of the .Net Guid type. That is contrary to what is stated in the documentation (https://apacheignite-sql.readme.io/docs/data-types#section-uuid).

SQL Example:
CREATE TABLE MyTable (Id INT not null, myUUID UUID, PRIMARY KEY (Id));
INSERT INTO MyTable (Id, myUUID) VALUES (0, '24E4A97A-96DC-47EB-89C0-9C44E60DC048');
SELECT myUUID FROM MyTable;

C#:

using System;
using System.Data.Odbc;

namespace IgniteUUIDWrongDataTypeReproducer {
    internal class Program {
        private static void Main(string[] args) {
            var connectionString = Environment.GetEnvironmentVariable("IGNITE_CONNECTION_STRING");

            using (var conn = new OdbcConnection(connectionString)) {
                conn.Open();

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "DROP TABLE IF EXISTS MyTable;";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "CREATE TABLE MyTable (Id INT not null, myUUID UUID, PRIMARY KEY (Id));";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "INSERT INTO MyTable (Id, myUUID) VALUES (0, '24E4A97A-96DC-47EB-89C0-9C44E60DC048');";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "SELECT myUUID FROM MyTable;";
                    using (var rdr = cmd.ExecuteReader()) {
                        rdr.Read();
                        var value = rdr[0];
                        Console.WriteLine($"{rdr.GetName(0)}='{value}' DotnetType='{value.GetType()}' DBType='{rdr.GetDataTypeName(0)}'");
                    }
                }
            }
        }
    }
}

Console Output:
MYUUID='System.Byte[]' DotnetType='System.Byte[]' DBType='VARBINARY'

Should be: (According to https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/sql-data-types?view=sql-server-2017
MYUUID='24E4A97A-96DC-47EB-89C0-9C44E60DC048' DotnetType='System.Guid' DBType='GUID'





On Mon, May 13, 2019 at 9:55 AM Igor Sapego <[hidden email]> wrote:
It seems like some encoding related issue to me.
Added a Jira ticket: [1].


Best Regards,
Igor


On Thu, May 2, 2019 at 1:15 AM Charles Rene <[hidden email]> wrote:
Hello,

I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver. I'm running a .Net Core 2.2 console application in a Linux environment in Docker.

The problem is that when I run a SELECT statement through .Net's System.Data.Odbc, I get back "bad data". It looks like a mismatch in encoding.

The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be "80579d98-9010-4610-b12e-ed33ed7d3c62".


Any idea what the problem might be?

Thank you,
Charlie
Igor Sapego-1 Igor Sapego-1
Reply | Threaded
Open this post in threaded view
|

Re: Need help with Linux ODBC Driver

Charles,

Thanks for the reproducer, I'll check it out. 

Best Regards,
Igor


On Thu, May 16, 2019 at 6:59 PM Charles Rene <[hidden email]> wrote:
Thanks Igor. I also noticed that the Linux ODBC Driver deserializes the Ignite UUID data type into a byte[] instead of the .Net Guid type. That is contrary to what is stated in the documentation (https://apacheignite-sql.readme.io/docs/data-types#section-uuid).

SQL Example:
CREATE TABLE MyTable (Id INT not null, myUUID UUID, PRIMARY KEY (Id));
INSERT INTO MyTable (Id, myUUID) VALUES (0, '24E4A97A-96DC-47EB-89C0-9C44E60DC048');
SELECT myUUID FROM MyTable;

C#:

using System;
using System.Data.Odbc;

namespace IgniteUUIDWrongDataTypeReproducer {
    internal class Program {
        private static void Main(string[] args) {
            var connectionString = Environment.GetEnvironmentVariable("IGNITE_CONNECTION_STRING");

            using (var conn = new OdbcConnection(connectionString)) {
                conn.Open();

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "DROP TABLE IF EXISTS MyTable;";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "CREATE TABLE MyTable (Id INT not null, myUUID UUID, PRIMARY KEY (Id));";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "INSERT INTO MyTable (Id, myUUID) VALUES (0, '24E4A97A-96DC-47EB-89C0-9C44E60DC048');";
                    cmd.ExecuteNonQuery();
                }

                using (var cmd = conn.CreateCommand()) {
                    cmd.CommandText = "SELECT myUUID FROM MyTable;";
                    using (var rdr = cmd.ExecuteReader()) {
                        rdr.Read();
                        var value = rdr[0];
                        Console.WriteLine($"{rdr.GetName(0)}='{value}' DotnetType='{value.GetType()}' DBType='{rdr.GetDataTypeName(0)}'");
                    }
                }
            }
        }
    }
}

Console Output:
MYUUID='System.Byte[]' DotnetType='System.Byte[]' DBType='VARBINARY'

Should be: (According to https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/sql-data-types?view=sql-server-2017
MYUUID='24E4A97A-96DC-47EB-89C0-9C44E60DC048' DotnetType='System.Guid' DBType='GUID'





On Mon, May 13, 2019 at 9:55 AM Igor Sapego <[hidden email]> wrote:
It seems like some encoding related issue to me.
Added a Jira ticket: [1].


Best Regards,
Igor


On Thu, May 2, 2019 at 1:15 AM Charles Rene <[hidden email]> wrote:
Hello,

I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver. I'm running a .Net Core 2.2 console application in a Linux environment in Docker.

The problem is that when I run a SELECT statement through .Net's System.Data.Odbc, I get back "bad data". It looks like a mismatch in encoding.

The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be "80579d98-9010-4610-b12e-ed33ed7d3c62".


Any idea what the problem might be?

Thank you,
Charlie
Charles Rene Charles Rene
Reply | Threaded
Open this post in threaded view
|

Re: Need help with Linux ODBC Driver

In reply to this post by Igor Sapego
Hi Igor, When will this issue be addressed? Thanks, Charlie

On Mon, May 13, 2019 at 9:55 AM Igor Sapego <[hidden email]> wrote:
It seems like some encoding related issue to me.
Added a Jira ticket: [1].


Best Regards,
Igor


On Thu, May 2, 2019 at 1:15 AM Charles Rene <[hidden email]> wrote:
Hello,

I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver. I'm running a .Net Core 2.2 console application in a Linux environment in Docker.

The problem is that when I run a SELECT statement through .Net's System.Data.Odbc, I get back "bad data". It looks like a mismatch in encoding.

The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be "80579d98-9010-4610-b12e-ed33ed7d3c62".


Any idea what the problem might be?

Thank you,
Charlie
Igor Sapego-1 Igor Sapego-1
Reply | Threaded
Open this post in threaded view
|

Re: Need help with Linux ODBC Driver

Hi,

I'm not working on this issue currently and is not aware
if anyone else in the community looking at it.

But I think it's going to be fixed by 2.8 or 2.9 as it looks
quite important.

Best Regards,
Igor


On Fri, Jun 7, 2019 at 7:53 PM Charles Rene <[hidden email]> wrote:
Hi Igor, When will this issue be addressed? Thanks, Charlie

On Mon, May 13, 2019 at 9:55 AM Igor Sapego <[hidden email]> wrote:
It seems like some encoding related issue to me.
Added a Jira ticket: [1].


Best Regards,
Igor


On Thu, May 2, 2019 at 1:15 AM Charles Rene <[hidden email]> wrote:
Hello,

I'm having trouble using the Apache Ignite 2.7.0 Linux built ODBC driver. I'm running a .Net Core 2.2 console application in a Linux environment in Docker.

The problem is that when I run a SELECT statement through .Net's System.Data.Odbc, I get back "bad data". It looks like a mismatch in encoding.

The data looks like  "8\00\05\07\09\0d\09\08\0-\0" where as it should be "80579d98-9010-4610-b12e-ed33ed7d3c62".


Any idea what the problem might be?

Thank you,
Charlie