Forum Moderators: open

Message Too Old, No Replies

Binary data in Access Database

SQL insert question

         

too much information

2:34 am on Apr 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have not had much luck in learning how to store image files in my database, but I have no problems uploading the images.

Does anyone have an example of an SQL statement to insert binary data into a database, and maybe some tips on going from a simple upload to an upload and insert of images?

digitalv

2:37 am on Apr 9, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I know this isn't the answer to your question, but this is really a bad idea for MS Access databases. A better solution would be to upload a file to a directory, and write the LOCATION of the file on the drive to the database as text.

Inserting binaries into access will increase the database size tremendously, and will slow down read/write times because you're dealing with a single file. Not to mention that if a script is ever stopped before the database connection is properly closed, the entire file will stay in memory even though it's not being used.

webboy1

9:09 am on Apr 10, 2004 (gmt 0)

10+ Year Member



I agree. I have recently needed a to create a script that allows me to upload docs to the server. I looked through both options i.e. doc/image to DB, and Doc/image to server with a reference in DB.

I decided on the later. I found a very simple upload script and edited it, and added in all the DB functions, and it works a treat.

I have heard from other people that docs (or images) sent straight to the DB in to be stored in Binary can cause quite a headache in the long run.

I am not at in the office right now, so don't have the URL to the script off hand, but if you like I can send you the URL, or the script i used? Although it could be a couple of days, cause i ain't back in the office until Tuesday.

Webboy