Saving a Clarion Blob to Microsoft SQL - Error: Access Violation

Hi everyone,

I have a Clarion 11 table with a Blob field which I’m trying to save to SQL (v16).
Clarion automatically creates the table on SQL, but when I try to insert the record, I get an error:

  • ERRORCODE() : 90
  • ERROR() : File System Error
  • FILEERRORCODE() : Access Violation
  • FILEERROR() : 5C541515 00CFEED8 0001:00080515 ClaRUN.dll

When adding a record directly on the SQL database, I can then read the Blob (SQL Text) field value from Clarion, but when trying to update from Clarion, it gives the same error as with the insert above.

I’ve tried SQL types Text / Varchar(Max) / Varbinary (Max) - all produces the same error.

Clarion File Definition:

SQL File Definition:
image

Clarion Code:
image

What if you omit using blobref and use directly BT:C2_Blob{PROP:Size} and BT:C2_Blob[0:Datasize-1]
With ADD instead of PUT it gives the same error ?

Hi Federico,

Thanks for your response.

I’ve used : BT:C2_Blob
and also : BlobTestTable.C2_Blob
prior to the blobRef.

Unfortunately I got the same error.
In order to try something different, I then tried blobRef.

I’ve also tried both ADD and PUT.
Firstly, with the Sql table empty, the ADD gave the same error.
Then I added the record manually to the MS Sql table - Initially with the Blob/Text field as null - same error.
Then I updated the Sql Blob/Text field manuallyto ‘a’. I could then read the value ‘a’ from Clarion. But then when using PUT - I got the same error again.

Hi,

Clarion Side
I have Under the Table Properties => Bindable ticked
and under the blob field Data Type as Blob and that is it.

SQL Side
varchar(MAX) for the Blob field in Clarion

And it works for me.

Hi Marius,

Thanks for the reply.

I do have the BINDABLE setting and the BLOB as type.
I did change the SQL type from TEXT to VARCHAR(MAX), which I have tried before but just wanted to be sure.

Still getting the error.

So, I guess it’s safe to say the Clarion side of things are correct, since it is working for you.

I will focus more on the Sql side settings now.

Thanks again.

If you don’t find the problem perhaps you could share here a small test project that reproduces it

I wonder what the CREATE table definition looks like, as you’re saying that Clarion creates it. And what the connection string is.

Hi Federico,

Here’s a Github link to the app:
TestBlobApp/ at main · janniesoftycomp/TestBlobApp · GitHub

I’ve added the MsSql driver trace and it seems the blob field is full of garbage when sending to Sql - possibly flowing over in restricted memory - cause the access violation.
You can find the complete log in the “TestBlobApp.txt” file here:
TestBlobApp/Gen/Bin at main · janniesoftycomp/TestBlobApp · GitHub

Here’s a snippet of the suspected garbage:

Apologies for not replying in a timely fashion. My time on this has become slightly restricted.
I have been able to save the blob via direct Sql statements from clarion - included in the app.

Regards

No problem, I was thinking in something even simpler. Anyway, it works here, both Add and Put, both Clarion and SQL. Attached the debug output produced by your test app.
TestBlobLog.zip (1,8 KB)

I see, it first worked because Clarion Trace was disabled. When I turned it on for MSSQL driver, it produced the error like you showed.
Now i recall this problem was mentioned sometime ago on Skype.
I’m not testing with the last release, I don’t know if this problem got resolved. If it doesn’t, perhaps you could record a PTSS. State specifically turning on Clarion trace…

Anyway, I found if you turn off this part of the trace (drivers.ini):
BindData=0
You can get a trace and the app working.

1 Like

Hi Federico,

Thank you. It was the Binding in the file driver trace. When I put it off, it works fine.