Joined: Mon Apr 09, 2007 10:29 am Posts: 14
|
Hi
I am saving images as binary file. Its about 4 MB in size.
I am using MySql as Database and the LongBlob as field.
When i use session.Save it throws an Exception
"MySql.Data.MySqlClient.MySqlException] {"Packets larger than max_allowed_packet are not allowed."}"
but the dimnesion of ByteArray is [4427572] and if the contents stored in the text file the size is only 1 MB
Everything works fine if the size is small.
<component name="Description" class="BusinessObjects.TestModule.DescriptionClass, BusinessObjects.TestModule">
<property name ="RtfByte" column ="Rtf_Description" type="BinaryBlob" not-null="true"/>
<property name="MhtmlByte" column="Mhtml_Description" type="BinaryBlob" not-null="true"/>
</component>
this is the code Rtf and Mhtml are the strings the i need in order to save to the database i am using Byte[] (though mapping them as StringClob in hbm also works and no need to convert i dont know which one is better any help in that??)
public string Rtf
{
get { return _rtf; }
set { _rtf = value; }
}
public string Mhtml
{
get { return _mhtml; }
set { _mhtml = value; }
}
private Byte[] RtfByte
{
get { return Encoding.UTF32.GetBytes(_rtf); }
set { _rtf = Encoding.UTF32.GetString(value); }
}
private Byte[] MhtmlByte
{
get { return Encoding.UTF8.GetBytes(_mhtml); }
set { _mhtml = Encoding.UTF8.GetString(value); }
}
Why is this error coming as i am saving directly to Db it works
Thanx
Saurabh
|
|