Help with storing PDF in SQLServer

General discussion forum about all databases other than SqlBase.
Maria

Help with storing PDF in SQLServer

Post by Maria » 22 Apr 2014, 21:28

Hi,
I'm trying to store a pdf document as a binary into SQLServer and I don't know what datatype to use in SQLServer (2008)

In SQLBase this works fine:

Set nSize = VisFileGetSize(sFileName)
If SalFileOpen( hFile, sFileName, OF_Binary )
Set nResult = SalFileRead( hFile, bBinary, nSize )
Call SalFileClose( hFile )
Call SqlPrepare( hSql, 'INSERT INTO pdftable VALUES( :nId,bBinary)' )
Call SqlSetLongBindDatatype( 2, 23 )
Call SqlExecute( hSql )
Call SqlCommit( hSql )
Return TRUE

Table definition in SQLBase:
create table pdftable (id number not null, pdffile LONG VARCHAR);

I try to use varbinary(max) as datatype in SQLServer, but
when I do a select from SQLServer, I get a binary back that is 32001 in datalength.
My binary are more than 150000 in datalengh..

Anyone who knows?
Best regards
Maria

a_sivababu
India
Posts: 503
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: Help with storing PDF in SQLServer

Post by a_sivababu » 23 Apr 2014, 06:06

Hi Maria
It works with Image data type but it may be deprecated after SQL Server 2014 release.

I think we need to check with Gupta whether there is any additional SET parameters to be setup for this varbinary(max).

Hope others in the forum might have experienced this issue.

Thanks!
Siva

EWetzel
Germany
Posts: 267
Joined: 07 Mar 2017, 12:08
Location: Germany

Re: Help with storing PDF in SQLServer

Post by EWetzel » 23 Apr 2014, 07:04

Hi,

I use the Datatype "VARBINARY" from SQLServer.

Enrico

ianrudge

Re: Help with storing PDF in SQLServer

Post by ianrudge » 23 Apr 2014, 11:00

+1 for Varbinary

Maria

Re: Help with storing PDF in SQLServer

Post by Maria » 23 Apr 2014, 12:54

Hi,
but are your varbinary bigger than 32000? It seems that there is a limitation at 32000?
Regards Maria

User avatar
markus.essmayr
Austria
Posts: 892
Joined: 06 Mar 2017, 06:07
Location: Austria

Re: Help with storing PDF in SQLServer

Post by markus.essmayr » 25 Apr 2014, 06:26

Hello,

VARBINARY(MAX) allows the storage of 2 GB of data. I think that's enough.
If you're using sqlodb32, check the sql.ini settings in the secion [odbcrtr].
Where is a value called longbuffer which limits the size of the transferred data.
(If it's not there, just add it!)

Code: Select all

[odbcrtr]
longbuffer=2500000
This is my setting and thats far enough!

Max
Markus Eßmayr
teamdeveloper@t-mx.com

Return to “General Discussion”

Who is online

Users browsing this forum: [Ccbot] and 0 guests