"File has caused an error and cannot be imported to the database" - MCMS 2002

Sometimes, whenever we try to upload any document (PDF, Image etc – with larger size) to the resource gallery in our MCMS 2002 application it throws an error with message “File has caused an error and cannot be imported to the database.”

If we check the application event log then we can see some logs with event ID 2400, 2403 with the description –

Event ID: 2400

Connection 018C2F60 <[Microsoft][ODBC SQL Server Driver][SQL Server]Length of text, ntext, or image data (198878) to be replicated exceeds configured maximum 65536.>{State=42000 NativeCode=7139}.

Event ID: 2403

Offending SQL: INSERT INTO BlobTable (BlobSecret, BlobFileExt, BlobGUID, BlobExecFlag, BlobMetaFlag, BlobTimeCreated, BlobSize, BlobData) VALUES (?, ?, ?, 0, 0, ?, ?, ?);Length of text, ntext, or image data (198878) to be replicated exceeds configured maximum 65536.

We can see that whenever you try to upload those documents it will throw an error and we can see it in the SQL profile trace.

Error: 7139, Severity: 16, State: 1

And the error message details will be there in the Application event log with the Event ID 2400. The error message will say that the Length of text, ntext, or image data (198878) to be replicated exceeds configured maximum 65536.

To work-around this issue we can increase the maximum configuration size instead of using the default value which is 65536. Actually it is the network packet size.

If you execute the below stored procedure then you can see the default configuration size in your DB. (By default it will be 65536)

exec sp_configure 'max text repl size'

To increase the maximum configuration size you can execute the below query.

exec sp_configure 'max text repl size',100000000

RECONFIGURE WITH OVERRIDE

After this if we try to upload those files again, then we can see that it will upload to the resource gallery successfully !