Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / March 2008

Tip: Looking for answers? Try searching our database.

Mange Large file in the database

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Husam - 11 Mar 2008 18:15 GMT
Hi EveryBody:

I have a web application made by ASP.Net 2.0 and vb.net, the purpose of this
project is to upload data from clinte machine and save these data to SQL 2005
database and when the clinte see his or her files in his member area in my
web application he can retrive his or her data just by clicking them and the
download will be start.

When I experiance my web application with a lot of people its work fine for
small data size 5 MB or less but when I delt with large data 100 MB or 1 GB
here is a problem.

The problem I face it with upload and download was SystemOut Of Memory.  
Some body toled me that If I had data set with 100 mB this is design problem.

So I do not want it to be so long Is there some body can Help me and Inform
me How can I bulid databsae and  data set that can Mange large file let us
assume
2 GB?

Any help will be appreciated

regard's

HusaM
George Ter-Saakov - 11 Mar 2008 18:28 GMT
With a big amount of data that is uploaded to SQL server from the Web you
will face 2 problems...

1. ASP.NET does not allow to upload files bigger than 4 megabytes by
default.

Solution: Check out this article for details
http://msdn2.microsoft.com/en-us/library/aa479405.aspx
OR you might need to use non .NET way to do it with some third party
component.

2. MS SQL can handle huge amount of data. The problem to get that data in
there (into database).  The problem is transaction log. It grows enormously
when you do repeated INSERT many thousand times. And MS SQL needs to
reallocate it constantly which is very costly and time consuming...

Solution: You need to do research on "bulk copy", specify correct BACKUP
model for your database.
You can use BULK INSERT or bcp.exe command.
bcp.exe allows you to have SQL server on separate machine than uploaded
file.

The way I did it is that I would take a file, make csv file out of it with
predefined columns and run bcp.exe to get it into SQL server.

PS: I heard that .NET 3.0 (or 3.5) supports bulk operation so you can do it
yourself instead of using bcp.exe

George.

> Hi EveryBody:
>
[quoted text clipped - 28 lines]
>
> HusaM
bruce barker - 11 Mar 2008 19:24 GMT
you have two issues upload and download. we will cover download first because
its simple.

1) to download, you page shoudl turn off bufferering and use the sqlserver
getbytes with a buffer (say 2k) or readtext function to read the data in
chunks, then response.write to write it.

2) upload is a different problem. the builtin control load the uploaded file
into memory (thus your out of memory message). you need to replace it with a
new upload control, that either writes to a temp file (many 3rd party do
this), or streams it the database.

unless you know how to write c/c++ isapi filters (or on iis7.0) you will
probably have to buy a 3rd party upload control.

-- bruce (sqlwork.com)

> Hi EveryBody:
>
[quoted text clipped - 21 lines]
>
> HusaM
Jeff Dillon - 11 Mar 2008 20:03 GMT
Have you considered writing the file to the file system, and only storing
the path/filename in the db?

Jeff

> Hi EveryBody:
>
[quoted text clipped - 28 lines]
>
> HusaM
Husam - 11 Mar 2008 23:46 GMT
Thanks for all of you guys:

but mr. Jeff actully I did not try to use your way that I saved the path of
file in the data base and the file in the file system.

Can you tell me how can I do so, and dose it work with large file?

regrad's

> Have you considered writing the file to the file system, and only storing
> the path/filename in the db?
[quoted text clipped - 33 lines]
> >
> > HusaM
Jeff Dillon - 12 Mar 2008 03:40 GMT
Copy the file to the server through file upload, and save the path in the
database.

> Thanks for all of you guys:
>
[quoted text clipped - 48 lines]
>> >
>> > HusaM

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.