[Mono-dev] Mono, TDS and SQL Server 2012

Chris Tacke ctacke at opennetcf.com
Fri Aug 1 21:33:13 UTC 2014


Martin,

Thanks.  Here are the details:


-          Running on Wind River Linux 3.4.43.5 on a Quark processor

-          Mono 3.2.7, built from source by me, specifically for 586 processors

-          CLR Version 4.0.30319.1720

Repro is actually pretty simple.  Create a SqlCommand and the call this:

command.ExecuteScalar(“SELECT SERVERPROPERTY('productversion')”);

And it goes south.  It also fails if you use ExecuteReader with the same statement and try to read the first field of the first row.

-Chris



From: martin at my2cents.co.uk [mailto:martin at my2cents.co.uk] On Behalf Of Martin Thwaites
Sent: Friday, August 01, 2014 4:05 PM
To: Chris Tacke
Cc: mono-devel-list
Subject: Re: [Mono-dev] Mono, TDS and SQL Server 2012


Couple of things that will help.

Mono version, platform and whether it was compiled from source or installed by soke other means
Sample app (not your entire codename, just a basic console app that replicates the issue).

In the first instance I would look at replicating this using basic stuff, I.e. Just a basic datareader on the table in a bear console app.

I believe it does work against 2012 though.  So I could be a specific data type or possibly specific data that's causing it.

I can possibly try to replicate on Sunday if you don't get any further response, but I think it's highly likely it's data or configuration specific not sql version.

Martin
On 1 Aug 2014 19:02, "Chris Tacke" <ctacke at opennetcf.com<mailto:ctacke at opennetcf.com>> wrote:
I’m trying to add SQL Server support to the Mono (on Linux, not Android if it matters) version of one of our products.

I have a codebase that works fine on Windows, but under Mono, it’s not behaving.  We’re using SQL Authentication, not NT.

I am able to get back a list of table names, so I know it’s “talking” to the database, but when I attempt to query rows from a table I get this:

[ERROR] FATAL UNHANDLED EXCEPTION: System.Exception: Unknown packet type 129
  at Mono.Data.Tds.Protocol.TdsComm.GetPhysicalPacketHeader () [0x00000] in <filename unknown>:0
  at Mono.Data.Tds.Protocol.TdsComm.GetPhysicalPacket () [0x00000] in <filename unknown>:0
  at Mono.Data.Tds.Protocol.TdsComm.Peek () [0x00000] in <filename unknown>:0
  at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00000] in <filename unknown>:0
  at System.Data.SqlClient.SqlCommand.ExecuteScalar () [0x00000] in <filename unknown>:0
  at OpenNETCF.ORM.SQLStoreBase`1[OpenNETCF.ORM.SqlEntityInfo].ExecuteScalar (System.String sql) [0x00000] in <filename unknown>:0
  at OpenNETCF.ORM.SqlServerDataStore.get_ServerVersion () [0x00000] in <filename unknown>:0
  at OpenNETCF.ORM.SqlServerDataStore.Fetch (System.String entityName, Int32 fetchCount, Int32 firstRowOffset, System.String sortField, FieldSearchOrder sortOrder, OpenNETCF.ORM.FilterCondition filter, Boolean fillReferences) [0x00000] in <filename unknown>:0
  at SolutionFamily.Storage.DataEntityProvider.GetEntityInstances (System.String entityName, Int32 skipNumber, Int32 retrieveNumber) [0x00000] in <filename unknown>:0
{more call stack omitted}

So it looks like the TDS version in Mono is old, maybe?  Packet type 129 looks like it’s a “result” packet:

http://www.freetds.org/tds.html#t129

And it’s been in use since SQL Server 7, which itself is pretty far from “recent”.

So my questions, I guess, Are:

-          Is connecting to a SQL Server 2012 database from a Mono app a supported scenario?

-          Is there a newer version of TDS on the System.Data.* stuff available that adds support?

-          Has anyone had any luck connecting to a “modern” version of SQL Server?

-          Any thoughts on how to proceed (other than debugging and attempting to implement this stuff myself)?

-Chris

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com<mailto:Mono-devel-list at lists.ximian.com>
http://lists.ximian.com/mailman/listinfo/mono-devel-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/mono-devel-list/attachments/20140801/b469bc07/attachment-0001.html>


More information about the Mono-devel-list mailing list