1

I'm using Matlab R2014a to access a SQL database.
I uploaded the data to the database using Matlab. The column is a FILESTREAM of type varbinary(MAX). When I query the database with a SQL command such as:

SELECT DATALENGTH(imagedata) from imagedata

I get datalengths of 8198400, which is consistent with my image data.

When I query the database with a SQL command such as:

SELECT imagedata from imagedata WHERE imageID<3

I get 32767 bytes of data per image.

SELECT CAST(imagedata AS varbinary(MAX)) from imagedata WHERE imageID<3

...also returns 32767 bytes of data per image.

I suspect this may be related to: Binary Blob truncated to 8000 bytes - SQL Server 2008 / varbinary(max), but the relationship isn't obvious to me.

One webpage has mentioned that 64-bit Matlab may have issues with ODBC drivers and that switching to JDBC solved the problem, but that isn't a satisfactory solution as I suspect I am either getting the SQL wrong or have some defaults set incorrectly somewhere.

Community
  • 1
  • 1
  • 1
    Well, it turns out that switching to JDBC does solve the problem. It turns out that it solves the problem a lot faster if you don't misspell the database name, which just gives a rather uninformative login failed error. I'm still interested in knowing whether this is just a matlab/sql/configuration bug on my end or if there is a real bug in matlab. – user3390022 Feb 17 '15 at 22:37

0 Answers0