Storing PDF Files As Binary Objects In SQL Server?
Feb 27, 2010
I have to find a design decision for the following task: I have a SQL Server database and it contains a table of orders. PDF documents will be uploaded by users through a simple file upload from a web page and assigned to an order. There is not more than one document per order (perhaps no document, never more than one). For this purpose a user opens a web page, enters an order number, gets the order displayed and clicks on an upload button. So I know to which order the uploaded document belongs to.
Now I am considering two options to store the documents on the web server:
1) Extend my table of orders by a varbinary(MAX) column and store the PDF document directly into that binary field.
2) Save the PDF file in a specific folder on disk and give it a unique name related to the order (for instance my order number which is a primary key in the database, or a GUID which I could store in an additional column of the order table). Perhaps I have to store the files in subfolders, one per month, and store the subfolder name into the order row in the database, to avoid getting too many thousand files in one folder.
After the PDF files are stored they can be downloaded and viewed via browser after entering the related order number.
I'm tending towards option (1) because the data management seems easier to me having all relevant data in one database. But I am a bit afraid that I could encounter performance issues over time since my database size will grow much faster than with solution (2). Around 90% or even 95% of the total database size would be made up only by those stored PDF files.
Here is some additional information:
The PDF files will have a size of around 100 Kilobyte each
Around 1500 orders/PDF files per month
Windows Server 2008 R2 / IIS 7.5
SQL Server 2008 SP1 Express
Not quite sure about the hardware, I believe one QuadCore Proc. and 4 GB RAM
Application is written in ASP.NET Webforms 3.5 SP1
(I am aware that I will reach the 4GB-limit of the SQL Server Express edition after around 2 years with the numbers above. But we can disregard this here, either removing old data from the database or upgrading to a full license will be a possible option.)
My question is: What are the Pro and Contras of the options and what would you recommend? Perhaps someone had a similar task and can report about his experience.
View 5 Replies
Similar Messages:
Aug 16, 2010
Have a question about the best approach for file storage in a SQL database. I have a table called Widgets, and each row in the Widgets table can have multiple files. I also have another table called Extensions, and again each record in this table can have many files.
Here is what I am considering:
Approach #1:
[Code]....
That approach is very simple and easy to use, but I feel that I could merge the two file tables into one, then use lookup tables:
Approach #2:
[Code]....
The thing is, there are no duplicate or shared files between the two types of objects. So even though I feel better about approach #2, I am concerned that I may be adding additional complexity (and using more server resources to perform the joins), than needed.
View 1 Replies
Jan 8, 2010
I am working on document management system. finding guide / code for Storing and Retrieving doc/pdf/xls files in SQL Server 2005.
View 1 Replies
Apr 15, 2010
Friends have quick question for you.i want to know storing videos and images into database(binary data) or local hard drive is efficent. What way general websites stores them in their websites.
View 6 Replies
Feb 26, 2010
Is there an easy way of storing an ArrayList containing different custom objects? I guess the easiest way for me would be to use a foreach to store each object into our database, but how would I read them out of the db and assigning them to the correct class?
View 8 Replies
Jan 14, 2010
This is in my opinion an abstract problem and I hope I can explain it well. I happened to find the same kind of problem in a completely different project and now I have it again and I would like to avoid it if possible.
I'm creating some classes to simplify some tasks for some specific requirements we have in some projects at work.
I have a class that creates objects which maps the values from webcontrols to an object properties similar to this
[URL]
The problem I have it's sometimes I have to store a non container object in a place (in an object's attribute) and sometimes I have to a store a container object in the same place for storing the values of a webcontrol (a webcontrol can sometimes hold several values like a checkboxlist). I dont like this at all, because some time ago when working in a non commercial compiler, when parsing and generating the intermediate code I had sometimes to store a container in a place, and sometimes I had to store a non container in the same place, and having to ask in other parts of the code if what you are reading is this type of object, or this another type of object, it is something really annoying and it mess up the code. Is there any tips about what it would be better to do to avoid this kind of situations or nothing can be done to avoid it sometimes?
View 3 Replies
Mar 17, 2010
My apps required me to store upload files into SQL binary fields. And then allow users to retrieve the files and either chose an apps to view them or save on disk. These files can be in diff formats, not just one type.
I have been reading about using the Response.ContentType method and Response.AddHeader method. The issue is the users can upload anykind of documents, ie: MS words, Xcel, JPEG,TIFF.... So at the time of downloading, I have no way of knowing that type it is to put in the Response.ContentType.
Can't I just stream it to the browser, let the download dialog box handle the type selection? as in when you download a file, the dialog box would ask if you want to select an app to open the file or save it on disk. How would I do so ?
View 1 Replies
Jun 29, 2010
I have to show the pdf files ,by the same time it should not get sotred in Temporary Files in the client Pc. Is there any control for this requriment.
View 5 Replies
Apr 14, 2010
I'm now working on a application which needs some pdf files (size 200kb -1Mb) to be stored into Mysql database.
View 2 Replies
Mar 20, 2010
I'm working on my high-school matriculation asp.net project, and I wish to make a website of a bookstore.
I want to create two classes,Book and BookStore, and save the data created in XML files and not in a database.
How can I save objects as XML files, and how can I load them afterwards?
View 1 Replies
Jan 14, 2011
I have a project where I need different versions of the same site.
I need to accomplish this by having different versions of the same resource files.
I would like to store the different versions of the same resource files in seperate projects in the same solution. Then choose which project of resource files to use when I publish or compile.
I've been searching the net everywhere and my deadline is coming up.
View 1 Replies
Sep 1, 2010
What is the recommended method of writing and storing class files in VS 2008, I'm using a web application?
View 2 Replies
May 7, 2015
along with a gridview update file that I store in my database
View 1 Replies
Jan 14, 2011
I have a project at work where I need different versions of the same site.
I need to accomplish this by having different versions of the same resource files.
I would like to store the different versions of the same resource files in seperate projects in the same solution. Then choose which project of resource files to use when I publish or compile.
I've been searching the net everywhere and my deadline is coming up.
View 8 Replies
Aug 6, 2010
I want to upload some large files from a web page to MS SQL Sever database, I am very sure that it is sounding weird.
File sizes are around 100MB.
I am having following settings,
SessionTimeOut period = 60 Mins,
Server Operation timeout = 60 Mins,
SQL Connection Timeout = 4 mins (Not sure if this is helping)
This is page is going to be used by our client only once a week & as they are having web farm environment we are avpiding to store these files on file systems.
Currenty we are able to upload files with sizes upto 8 MB succesfully. But when we are uploading a file of 100MB it fails, its for sure that operation takes lots of time.
View 4 Replies
Feb 15, 2011
I have hosted a website in Client's Server.
One of the functionality of the site is to create a PDF File on a Specific Shared Path.
The Shared path is mentioned in the Web.Config File.
If the given shared path exists in the same machine then the PDF File is created and stored in the shared path.
If the Shared path exists in the other shared network System then the PDF is not created and not stored in the shared path.
View 3 Replies
Jun 29, 2010
I want to show my online pdf document to client (like e-paper PDF document display.)
But after display the online pdf document to client then the document will be store on client Temporary Internet Files.
How to avoid storing in local Temporary Internet Files after viewed online pdf document in asp.net?
I want to secure my pdf document ?
Any possibility to avoid storing PDF documents in local Temporary Internet Files?
View 1 Replies
Apr 29, 2010
Input: - 3 excel files storing them into global temporary tables after reading cell by cell.
Requirement is to process inputs files and generate a single excel report.
After report gets exported, data in tables in should be deleted (i am using global temp tables for this).
But the problem is, two users are unable to generate report simultaneously.
Is this problem with global temporary tables?
View 1 Replies
Sep 20, 2010
Is it possible to convert a datatable into binary data and save it into on a binary field on database?
View 2 Replies
Feb 3, 2011
I have a problem with deserializing in C#/ASP.NET, which gives the exact error:
The input stream is not a valid binary format. The starting contents (in bytes) are: 41-41-45-41-41-41-44-2F-2F-2F-2F-2F-41-51-41-41-41 ...
What I am trying to do
I have a structure with 3 classes. I have a class A which is a base class, and then class B and C which are derived from A.
I am trying to store random types of B and C in the database using LINQ to SQL, in a column with the type VARCHAR(MAX).
I cannot use BINARY as the length is around 15.000.
My code...
[code]...
So the error happends when the first Deserialize method is run, with the above error.
View 2 Replies
Sep 24, 2010
I have an ASP.NET app that writes binary data to a SQL database. It worked fine using SQL Express, but does not ever write the data using SQL Server 2008 R2. SQL Profiler shows the binary data in the UPDATE query, but nothing happens... no errors, no data saved. Does anyone know what I'm missing? Other data types work fine.
My data type is VarBinary(MAX)...
View 7 Replies
Oct 30, 2010
Is it possible to send a binary file file from client to server using ajax???
am using ActiveXObject("Scripting.FileSystemObject") to get a binary file from client. I need to send the binary data to server.
View 2 Replies
Nov 1, 2011
Any code snippet or third party utilities to do this? Anything built into .NET libraries?
View 3 Replies
Sep 7, 2010
I have a web page and want to allow viewers to upload data both binary and text (seperate uploads of course) to a database on the server.
View 1 Replies
Mar 23, 2011
Whenever I add more than a very short string to the "description" column in my table I get this error. That column (in the DVD table) is set to NVARCHAR(1000). I can't see what the problem is. I've add the procedure that throws exception below.
System.Data.SqlClient.SqlException was unhandled by user code
Message="String or binary data would be truncated.
The statement has been terminated."
Source=".Net SqlClient Data Provider"
ErrorCode=-2146232060
[Code]....
View 3 Replies