471,354 Members | 1,279 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,354 software developers and data experts.

MySQL & BLOB field retrieving

pmz
Dear Group,

I'm connecting in C# with remote (BSD) MySQL server with ODBC Driver,
and I'm trying to find the best sollution in such problem:

As I've read on MySQL manual, they have suggested table design
including the BLOB-Fieldtype size in UInt64, where they've stored,
while inserting, the size of inserted BLOB data. But in the matter of
fact, I'm interested if it's necessary to include in table this integer
field? Is there any way to get size of inserted blob data? In matter of
fact, just before fetching data, I may create byte[] array with size
equal maximum capacity of medium/tiny/*/blob fields, but it's kind of
wasting memory, isn't it?

Thanks a lot for all answers & proposals and time wasted on my problem.

Best regards,
Przemek M. Zawada

Jan 30 '06 #1
2 8872
Przemek,

Here is a way of reading blob without knowing its size to start with:
http://msdn.microsoft.com/library/de...omdatabase.asp

However, in our Interbase database, we store the size in another field and
then use it with the OdbcDataReader's GetBytes method to read it all the
data at once.

I've not used MySQL; however, I just recently read that the version 5.0 of
the database comes with .NET database drivers. I took a look at the
MySqlDataReader methods at:
http://dev.mysql.com/doc/refman/5.0/...reader-methods
and I don't see a method other than the GetBytes method for retrieving
binary information from a database, so you are probably going to have use
the same sort of retrieval method as the OdbcDataReader class offers, which
is kind of sad. Oh well, I would assume that the MySql native components
can retrieve data from the MySQL database faster than the Odbc components
that come with .NET, so you may want to use them or at least test my theory.
Later,
Dave
Jan 30 '06 #2
pmz
Indeed! Thank you for hints! GetBytes() works perfectly!

Best regards,
Przemek M. Zawada

Feb 4 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Thierry | last post: by
7 posts views Thread by AF | last post: by
1 post views Thread by Raaijmakers, Vincent (GE Infrastructure) | last post: by
7 posts views Thread by sime | last post: by
1 post views Thread by Eref DURNA | last post: by
4 posts views Thread by Claus Konrad | last post: by
7 posts views Thread by greywire | last post: by
Atli
6 posts views Thread by Atli | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.