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

ESP
106449
accept rate: 0%

edited 21 Feb '13, 04:06

Volker%20Barth's gravatar image

Volker Barth
40.1k361549819

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: http://dcx.sybase.com/index.html#1201/en/dbadmin/design-s-3180714.html

What API do you plan to use to communicate with the database? You have many options: ODBC, ESQL, JDBC, OLEDB, and many more. See http://dcx.sybase.com/index.html#1201/en/dbprogramming/dbprogramming12.html

(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 !

select UDF_THAT_INCLUDES_A_READ_CLIENT_FILE_CALL('C:\\TEST.PDF') 
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...
2.7k293965
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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×119
×30
×22
×11

question asked: 20 Feb '13, 16:24

question was seen: 6,612 times

last updated: 22 Mar '13, 03:01