LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Database Connectivity Toolkit PROBLEM: ignoring adLongVarChar and adLongVarBinary ADODB types

Using LV2013.

in ADODB, 'adLongVarChar' is the datatype for "TEXT" and 'adLongVarBinary' is the datatype for "BLOB". 
NI_Database_API does not implement them, in the VI "vi.lib\addons\database\Auxilliary.llb\DB Tools Type and Dir to ADO.vi" it is always 'adVarChar' and 'adBinary'. This is wrong.
For some DBMS  this might not be a problem, but for SQL Server this is a big problem. 
If you don't specify its an adLongVarChar, SQL Server right truncate data to 8000 bytes, indeed it gives an error and drop the changes. 

This error seems to be ignored due old versions of SQL Server used to support only up to 8000 bytes in a row column, but now if you specify VARBINARY(MAX) - you will need to use adLongVarBinary to use the 2TB MAX of space, or if you use TEXT (which is an alias to VARCHAR(MAX)) you will need to use adLongVarChar to use the 2TB MAX of space in row column. 


I've made fixes in the NI_Database_API by myself for it to work. I feel like NI_Database_API is abandoned.

I usually don't use this API, only when I need ODBC connectivity, usually I use SQLlite for my applications.


I've found out the problem by reading this http://stackoverflow.com/questions/1074428/how-to-write-to-a-varcharmax-column-using-odbc


Attached the fix done, now inserts of long text and blobs working.

0 Kudos
Message 1 of 4
(3,971 Views)

Report it as a bug and see what happens. 

aputman
0 Kudos
Message 2 of 4
(3,962 Views)

Following your suggestion, aputman, made a service request ( #7446915 ).
But it is intersting to be here in forum, as other might issue this error. I've lost about a day to find this problem. 

0 Kudos
Message 3 of 4
(3,958 Views)

Thank you!

 

Just came to same conclusion independently but to put some more weight behind I just had this issue. This makes the toolkit incompatible with the new (well since 2005) sql server nvarbinary(max) times.

 

Cheers,

James

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 4 of 4
(3,804 Views)