RE: How to use mssql varbinary type with SB ?

thumbnail
Roman Novikov, modified 7 Years ago. Junior Member Posts: 39 Join Date: 1/7/17 Recent Posts

Hello!

I'm trying to map an existing MS SQL table to a Service Builder table. The original table has a VARBINARY typed column.

How should be it using with SB? Which type should I use for mapping this field?

thumbnail
David H Nebinger, modified 7 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts

what kind of data is it?

I don't think there's any support for blob fields, you may have to go native to get to the input stream for the blob...

thumbnail
Minhchau Dang, modified 7 Years ago. Liferay Master Posts: 598 Join Date: 10/22/07 Recent Posts
David H Nebinger:

I don't think there's any support for blob fields, you may have to go native to get to the input stream for the blob...

Liferay has just enough support for blob fields to implement the DLContent table, where the data field is declared as a Blob.

For SQL Server, Liferay will auto-generate table create statements that have those fields declared as (currently deprecated) image type, but Liferay otherwise interacts with it at the JDBC level as though it's a java.sql.Blob. Therefore, I suspect that if the underlying table uses an nvarbinary, everything should work just fine, even without LPS-62804 implemented.

thumbnail
Roman Novikov, modified 6 Years ago. Junior Member Posts: 39 Join Date: 1/7/17 Recent Posts

Thank you Minhchau! Thank you David!

I thought about Blobs too. But this case was successfully avoid by changing data type to VARCHAR2 for that column was considered for some crypto hash to be stored. So I haven't had a chance to test this with Blob yet.. But I suspect I'll have to face to this stuff with this ancient SQL-database. I'm going to write down here about this experience as it will happen.