|
-
Apr 6th, 2017, 09:56 AM
#1
[RESOLVED] MySQL - Large text field causes ConstraintException
Hi all,
I'm having a strange problem with one of my tables. I've been using this table for quite some time, then the customer gave me a requirement to attach data in an excel file to the table. Since the data in excel table needs to edited in the application, I can't just store a path to the file. Also, the excel file for each row is too different to create a new table just for the excel data. Each excel file has a different number of columns, different column heading, etc. The working solution is to collapse the excel file into a csv string and stuff that into a field of the table. This works(ed) file until the customer gave me a file that had 300+ rows.
The large excel file collapsed into a string that was about 22,000 characters (below the 64K limit of a MySQL text field) and the entire string saves in the DB without issue. It's when I try to fetch the row with the large excel string that I get the Constraint exception. Furthermore, if I ignore the exception, the data loads fine and completely, so although there is an exception raised, I don't know why, and the only thing I've been able to do is ignore it.
Has anyone seen this issue or anything like it? My working solution is to simply catch the Constraint exception and ignore it, but in doing so I am potentially ignoring exceptions that I shouldn't.
Thanks for your time
kevin
edit:
Changing the MySQL field to LONGTEXT results in the same exception being thrown.
Also, the exact number of excel rows causing the problem is 323. If I reduce the number of rows to 300, I don't have a problem, so it seems that in this case, size does matter.
Another tid-bit... I am loading a data table directly using this code...
vb.net Code:
Dim dT as new datatable dT.Load(cmd.ExecuteReader)
but when I run the command string directly on the database (outside of the .net environment) it runs fine.
Last edited by kebo; Apr 6th, 2017 at 02:23 PM.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|