Please be aware that the content in SAP SQL Anywhere Forum will be migrated to the SAP Community in June and this forum will be retired.

We are wanting to store PDF files in our Sybase 10 database. Some of them are up to 50 megabytes in size. I looked it up online and saw that the Image datatype in a table appears to hold what we need.

How do you implement this feature? I am new to using BLOB's in databases and am unsure how to encode the pdf data into binary and store it in the database.

asked 20 Feb '13, 16:24

ESP's gravatar image

accept rate: 0%

edited 21 Feb '13, 04:06

Volker%20Barth's gravatar image

Volker Barth

This depends on the connectivity technology that you plan to use. You can use the xp_read_file/xp_write_file system procedures as an option.

(20 Feb '13, 21:42) Chris Keating

You will want to use a LONG BINARY data type for the column to store the PDF content. Take a look at the documentation to read about some considerations when dealing with BLOBs:

What API do you plan to use to communicate with the database? You have many options: ODBC, ESQL, JDBC, OLEDB, and many more. See

(20 Feb '13, 23:05) Mark Culp

IMHO I'm not a fan of using large blob files in server tables. You could think about a Directory Server where you can save you files in a directory of the server.

IF you use ASA 11 and above .....

To Transfer Files to the Server without additional Data Connections check out the Documentation about Access to data on client computers.

If you use ODBC to connect to the Server you can use it directly out of the box. Make sure that you statement includes the READ_CLIENT_FILE() function directly.

This Works

select READ_CLIENT_FILE('C:\\TEST.PDF') into BlobVar from dummy;

This will case an error !

into BlobVar from dummy;

The ODBC Driver will do some magic on the executed Statement to get your data to the DB Server.

permanent link

answered 22 Feb '13, 06:28

Thomas%20Duemesnil's gravatar image

Thomas Dueme...
accept rate: 17%

edited 22 Feb '13, 06:33

Just to note: Apparently, storing the files outside the database (which surely has its benefits) means you have to backup these files in addition to the database backup.

(22 Feb '13, 07:01) Volker Barth
Replies hidden

And these transactions are not transactional !

(22 Mar '13, 03:01) Thomas Dueme...
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 20 Feb '13, 16:24

question was seen: 6,691 times

last updated: 22 Mar '13, 03:01