How to store large html content in a database? CMS development

I am developing a content management system for my site. I am facing problems how to store large html content in a database. Stored procedures limit its parameters to 8000 characters and do not accept any content greater than this length. so how can i store my content in a database.

Or is there another better way to get the job done, where to store the html content. Also how is the image (inside html) or its links stored, what would be the implementation scenario?

Many CMS systems are running how they have implemented this functionality.

Please provide the best ideas on how to deal with this requirement.

Tools I am using: C # .net SQL Server 2005 Asp.net 2.0

+3


source to share


4 answers


If you are using SQL Sever 2005 why not use the datatype VARCHAR(MAX)

?

VARCHAR(MAX)

and NVARCHAR(MAX)

can contain the same amount of data as the old ones TEXT

and NTEXT

can contain (2GB), but they are much more flexible than TEXT

/ NTEXT

. They are stored in data pages of the same type that are used for other data types.



As far as images go, I would recommend storing them on the filesystem and just using regular tags img

that point to them.

It is quite typical for a CMS to store the content of an article in a table that will later be embedded in the template. Though databases like MongoDB are becoming more popular for this type of application.

+5


source


You might want to read about big value datatypes here - http://msdn.microsoft.com/en-us/library/ms178158(v=sql.90).aspx



You can use large value data types to store up to 2 ^ 31-1 bytes of data. Hope this helps.

0


source


Use blob fields in your database (like BIGTEXT in MySQL). Then you can pass your HTML content to the database field. Alternatively, if you want to use a document type approach, save the HTML content as a file and store the location of the content in your database. The latter approach is good if you want to use hadoop and the like. To search for a huge amount of content. If you are going to start something simpler, I would go with the blob approach as finding content in blobs has come a long way over the past few years. However, keep in mind that the clustered version of MySQL (for example) doesn't have much support for some things you might need, like xpath.

0


source


You shouldn't save images, HTML or anything that won't be used in SQL WHERE clauses. Instead, I would store these HTML snippets and images in the file system, something like [PARENT_TABLE_NAME]. [ROW_PRIMARY_KEY] .html. This way you free up database time when querying, since you probably won't be using WHERE filters with these HTML snippets, and your HTML updates / deletes / inserts cannot be faster AND can be cached correctly by the OS.

0


source







All Articles