Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 502663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:18:52+00:00 2026-05-13T06:18:52+00:00

I’m trying to insert an HTML blob into our sql-server2005 database. I’ve been using

  • 0

I’m trying to insert an HTML blob into our sql-server2005 database. I’ve been using the data-type [text] for the field the blob will eventually live in. I’ve also put a ‘@Lob’ annotation on the field in the domain model. The problem comes in when the HTML blob I’m attempting to store is larger than 65536 characters.

It seems that is the character-limit for a text data type when using the @Lob annotation. Ideally I’d like to keep the whole blob intact rather than chunk it up into multiple rows in the database.

Allow me to clarify
annotation:

 @Lob   
 @Column(length = Integer. MAX_VALUE) //per an answer on stackoverflow  
 private String htmlBlob;  

database side (sql-server-2005):

CREATE TABLE dbo.IndustrySectorTearSheetBlob(  
   ...  
      htmlBlob text NULL    
...
)

Still seeing truncation after 65536 characters…

EDIT: I’ve printed out the contents of all possible strings (only 10 right now) that would be inserted into the Database. Each string seems to contain all characters, judging by the fact that the close html tag is present at the end of the string….

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T06:18:52+00:00Added an answer on May 13, 2026 at 6:18 am

    Actually, I think that what you’re looking for is a CLOB field. Quoting Using Advanced Data Types:

    BLOB and CLOB and NCLOB Data Types

    The JDBC driver implements all the
    methods of the java.sql.Blob,
    java.sql.Clob, and java.sql.NClob
    interfaces.

    Note: CLOB values can be used with SQL
    Server 2005 large-value data types.
    Specifically, CLOB types can be used
    with the varchar(max) and
    nvarchar(max) data types, BLOB types can be used with
    varbinary(max) and image data types, and NCLOB types can be used
    with ntext and nvarchar(max).

    In other words, use a VARCHAR(MAX) or a NVARCHAR(MAX) if you need unicode support. About their maximum length:

    The maximum storage size for VARCHAR(MAX) is 2^31-1 bytes (2,147,483,647 bytes or 2GB – 1 bytes). The storage size is the actual length of data entered + 2 bytes. The data entered can be 0 characters in length. Since each character in a VARCHAR data type uses one byte, the maximum length for a VARCHAR(MAX) data type is 2,147,483,645.

    The maximum storage size for NVARCHAR(MAX) is also 2^31-1 bytes (2,147,483,647 bytes or 2GB – 1 bytes). The storage size, in bytes, is two times the number of characters entered + 2 bytes. The data entered can be 0 characters in length. Since each Unicode character in an NVARCHAR data type uses two bytes, the maximum length for an NVARCHAR(MAX) data type is 1,073,741,822.

    That should be enough for your HTML.

    EDIT: On the Hibernate side, your annotated entity looks fine. On the database side, it should be ok. However, could you try to use VARCHAR(MAX) instead of TEXT (and remove this doubt about TEXT).

    CREATE TABLE dbo.IndustrySectorTearSheetBlob (
    ...
    htmlBlob varchar(max) NULL
    ... 
    )
    

    By the way, what Hibernate dialect are you using? And what JDBC driver are you using?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 371k
  • Answers 371k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This answer provides an MSDN quote that answers my question:… May 14, 2026 at 6:52 pm
  • Editorial Team
    Editorial Team added an answer The string is initialised with no characters, or "" internally.… May 14, 2026 at 6:52 pm
  • Editorial Team
    Editorial Team added an answer All you need to do is change the string within… May 14, 2026 at 6:52 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.