1. We want to load the PDF file into Sybase DB from PB.
2. Retrieved the Stored PDF doc from Sybase & display in PB
window.
Any clues would be highly appreciated.
Thnx
AR
We do that in one of my client's systems. The PDF's are stored in an
"Image" data type and updated using the UpdateBlob syntax. For retrieval,
the SelectBlob is used and the information written to a file where you can
now use a Run ( ) command on the reconstituted PDF. To upload a new PDF, the
FileReadEx ( ) method is used to load the PDF into a Blob variable prior to
the UpdateBlob request.
If you want the PDF displayed directly in your PB application, use the
Acrobat ActiveX as an OLE control. For web browser display, return a byte
array to the JSP or ASP web page and issue a Response.WriteBinary ( ).
HTH
Regards ... Chris
<AR> wrote in message news:44f5d276.409...@sybase.com...
PB10 has functions that will read an entire file in one call.
Good luck,
Terry [TeamSybase] and Sequel the techno-kitten
*********************************
PowerBuilder for $95? No.
Personal use PowerBuilder Enterprise *AND* PocketBuilder *AND* DataWindow.NET
*AND* Sybase IQ as free benefits of a $95 ISUG membership. See
http://www.isug.com/ISUG3/Membership_benefits.html for details.
*********************************
Click once a day to help the hungry
http://www.thehungersite.com
*********************************
User Manual
===========
TeamSybase <> Sybase employee
Forums = Peer-to-peer
Forums <> Communication with Sybase
IsNull (AnswerTo (Posting)) can return TRUE
Forums.Moderated = TRUE, so behave or be deleted
*********************************
Sequel's Sandbox: http://www.techno-kitten.com
Home of PBL Peeper, a free PowerBuilder Developer's Toolkit.
Version 3.0.02 now available at the Sandbox
PB Futures updated Apr 24/2006
See the PB Troubleshooting & Migration Guides at the Sandbox
^ ^
o o
=*=
Is there anyway that I can reach Chris Polloch directly
since he seems to have implemnted this for one of his
clients?
A
Good luck,
Terry [TeamSybase] and Sequel the techno-kitten
On 31 Aug 2006 10:03:28 -0700,
in sybase.public.powerbuilder.general
*AND* Sybase IQ as free benefits of am ISUG membership. See
1) What database access mechanism are you using (We are using Sybase's Open
Client native drivers)?
2) In your SQL example below .. Does ID=1 exist?
3) You should check the DB return code after the UpdateBlob command.
Contact info: http://chrispollach.pbdjmagazine.com
Regards ... Chris
<AR> wrote in message news:44f713ba.4ca...@sybase.com...
sqlca.AutoCommit = true
SELECTBLOB pdf_doc
INTO :ls_pdf_doc
FROM pdf_test WHERE id = 1 USING sqlca ;
ls_filename = "c:\tst.pdf"
ll_filelen = Len(ls_pdf_doc)
li_filenum =
FileOpen(ls_filename,STREAMMODE!,WRITE!,SHARED!,APPEND!)
ls_pdf_doc = BlobMid(ls_pdf_doc,1,32000)
ll_bytes_write = FileWrite(li_filenum,ls_pdf_doc )
FileClose(li_filenum)
------------ Code End---------
When I try to open the file, I am getting a "There was an
error opening the document. The file is damaged and could
not be repaired" Error msg & the file is not opening.
Were you able to creat a PDf file from the Blob?
===============================================
1) Since you are using ODBC - be careful of the Blob limit. Make sure you
set the following parameters in the PBODBC.ini file ...
PBMaxBlobSize='32767' // or whatever max you expect!
PBMaxTextSize='32767'
2) Why are you doing a BlobMid ( ) ? I think this might be messing you up!
3) Use the FileWriteEx ( ) method
4) Use the LockWrite! option in the FileOpen ( ).
Chris
<AR> wrote in message news:44f72be5.45...@sybase.com...
I even tried to open a file with ".PDF" option & write a
string hoping to test if I am just able to create a PDF file
& write to it successfully. Even this is causing the same
error msg as before ("There was an error opening the
document. The file is damaged and could not be repaired" ).
The PDF is being created. But when I try to open the file, I
get the error msg. I am not using any BLOBs now.
Below is my SIMPLE code that has no rooms for any errors,
but still.....
------------------------------
ls_filename = "c:\tst.pdf"
li_filenum =
FileOpen(ls_filename,STREAMMODE!,WRITE!,LOCKWRITE!,APPEND!)
ll_bytes_write = FileWrite(li_filenum,"anil" )
FileClose(li_filenum)
------------------------------
For a simple test should you not 1) read the original PDF into a Blob
variable and then 2) write it to a new file. The new file should then open
OK under Acrobat.
<AR> wrote in message news:44f85a36.13c...@sybase.com...