Congratulations to all monthly winners of May 2013 !!! They have won INR 2900 cash and INR 27497 worth prize.
DotNetFunda.Com Logo
Twitter TwitterLinkedIn
YouTubeGoogle
 Online : 8173 |  Welcome, Guest!   Register  Login
 Home > Forums > VB.NET > How to set maximum value of a blob type in mysql ...
Jerome

How to set maximum value of a blob type in mysql

Replies: 24 | Posted by: Jerome on 4/23/2012 | Category: VB.NET Forums | Views: 2172 | Status: [Member] | Points: 10  


I want to attach files to a blob field in mysql,but the problem is I can't attach images more than 1 mb in size.How could I solve my problem?Need Help!


Thanks


Reply | Reply with attachment | Alert Moderator

 Responses below this adGet hundreds of .NET Tips and Tricks videos

 Replies

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 9:18:19 PM
Level: Silver | Status: [Member] | Points: 25

Uploading images into a MySQL database table is a bad idea

For more details, refer this link..

http://www.hockinson.com/programmer-web-designer-denver-co-usa.php?s=47

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 9:21:44 PM
Level: Silver | Status: [Member] | Points: 25

if you want to store big binary data in a MySQL database you need to use another blob type as MEDIUMBLOB or LONGBLOB

Refer this article, its sure to helps to u...

http://enricogi.blogspot.in/2008/12/blob-type-in-mysql.html

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/23/2012 9:42:29 PM
Level: Starter | Status: [Member] | Points: 25

Hi Singaravel M,

I already used LongBlob dataype but it gets error when I try to save big binary data.Do you have other idea instead?



Jerome
Thanks

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 9:46:41 PM
Level: Silver | Status: [Member] | Points: 25

can i know error details..?

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/23/2012 9:52:31 PM
Level: Starter | Status: [Member] | Points: 25

data loo long for coulum pic,which my field name...



Cheers,
Jerome

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 9:59:53 PM
Level: Silver | Status: [Member] | Points: 25

It all depends on the column type used for the picture column

.TINYBLOB: maximum length of 255 bytes
.BLOB: maximum length of 65,535 bytes
.MEDIUMBLOB: maximum length of 16,777,215 bytes
.LONGBLOB: maximum length of 4,294,967,295 bytes

compare with ur image size and use correct data type...

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 10:06:31 PM
Level: Silver | Status: [Member] | Points: 25

This error throws only when input size is exceed the declaration size..

So once again check it..

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/23/2012 10:44:31 PM
Level: Starter | Status: [Member] | Points: 25

What if image size exceeds long blob max length..

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 11:05:08 PM
Level: Silver | Status: [Member] | Points: 25

yes

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 11:06:47 PM
Level: Silver | Status: [Member] | Points: 25

what is ur image size...?

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/23/2012 11:37:17 PM
Level: Starter | Status: [Member] | Points: 25

image size is 5mb

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/23/2012 11:44:59 PM
Level: Silver | Status: [Member] | Points: 25

okay..

i can't get any idea..

Refer the following example with ur code..

EXAMPLE for,
How to store pictures in Mysql database

http://forums.mysql.com/read.php?20,17671,27914

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bugwee
Bugwee  
Posted on: 4/24/2012 12:19:49 AM
Level: Starter | Status: [Member] | Points: 50

Resolved

the max allowed packet variable in your sql server exceeds.

try to run :

set max_allowed_packet = 500M


now restart the MySQl service and you are done

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/24/2012 1:05:53 AM
Level: Starter | Status: [Member] | Points: 25

where did I put this code?

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bugwee
Bugwee  
Posted on: 4/24/2012 1:10:24 AM
Level: Starter | Status: [Member] | Points: 25

run it on the mysql query browser or in mysql workbench...

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bugwee
Bugwee  
Posted on: 4/24/2012 1:14:11 AM
Level: Starter | Status: [Member] | Points: 50

Resolved

you can also change directly the packet size via Mysql Administrator... locate and change the max_allowed_packet, under Startup Variables

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/24/2012 1:14:31 AM
Level: Starter | Status: [Member] | Points: 25

what do you by 500M?megabyte?

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/24/2012 1:17:47 AM
Level: Silver | Status: [Member] | Points: 25

yes 500 MB

Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bugwee
Bugwee  
Posted on: 4/24/2012 1:19:38 AM
Level: Starter | Status: [Member] | Points: 25

Yes right. M = megabyte.

by default the max allowed packet size = 1M. if you want to insert files greater than 1M then you will got a max_allowed_packet error.

If you want to insert 5mb files or lesser then set the max allowed packet to 5M.

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/24/2012 1:43:55 AM
Level: Starter | Status: [Member] | Points: 25

I could not find max_allowed_packet under startup variable.I also run the code in mysql query browser and it gets error."Incorrect argument type to variable 'max_allowed_packet' "

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Bugwee
Bugwee  
Posted on: 4/24/2012 2:05:00 AM
Level: Starter | Status: [Member] | Points: 25

Did you find the Startup variable or Startup parameter on the mysql Admistrator? i think, if you click on that there are tabs displayed like General parameters, my isam parameters, innodb parameters, etc.... find the the packet size in any of the tabs... i think you can see there like default value = 1M.

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/24/2012 2:38:50 AM
Level: Silver | Status: [Member] | Points: 25

edit your my.cnf file and add

max_allowed_packet=500M 


then restart



Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Jerome
Jerome  
Posted on: 4/24/2012 3:32:36 AM
Level: Starter | Status: [Member] | Points: 25

where would I found my.cnf file?

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Sakthi.Singaravel
Sakthi.Singaravel  
Posted on: 4/24/2012 3:44:12 AM
Level: Silver | Status: [Member] | Points: 25

By default found at:

/etc/my.cnf

or

/etc/mysql/my.cnf


Regards,
Singaravel M

Jerome, if this helps please login to Mark As Answer. | Reply | Alert Moderator 

Reply - Please login to reply


Click here to login & reply

About Us | Contact Us | The Team | Advertise | Software Development | Write for us | Testimonials | Privacy Policy | Terms of Use | Link Exchange | Members | Go Top
General Notice: If you find plagiarised (copied) contents on this page, please let us know the original source along with your correct email id (to communicate) for further action.
Copyright © DotNetFunda.Com. All Rights Reserved. Copying or mimicking the site design and layout is prohibited. Logos, company names used here if any are only for reference purposes and they may be respective owner's right or trademarks. | 6/19/2013 3:14:35 AM