473,320 Members | 1,839 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 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 8981
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Thierry | last post by:
Hello, I do have a mysql database with a BLOB column. What is the proprest way to read this column ? Thx, Thierry
7
by: AF | last post by:
I am a real novice to php and MySQL, with about a week's worth of reading and self tutoring. I have an urgent need to publish a database of information and need some guidance on how to do this. ...
1
by: Raaijmakers, Vincent (GE Infrastructure) | last post by:
It is the first time that I use blobs in mysql. Please help me out here..... Using MSSQLdb and python 2.3.4 I was surprised to see how my information was stored in the blob. My goal is to store...
7
by: sime | last post by:
Hi, I have a blob field in a mysql database table. I want to copy a blob from one record to another. I am having trouble transferring the data via a php variable. Maybe I need to addslashes or...
1
by: Eþref DURNA | last post by:
hello, I have a mysql database(which I could not modify) and there is a Field type of blob which exuals to byte at mysql. I could not read the data from mysql to get that byte values and convert...
4
by: Claus Konrad | last post by:
Hi What's the better way for retrieving a very large BLOB field from a SQL 2000 (image-field)? I'm currently usign a SqlDataReader, but it times out before all data is retrieved from the table...
7
by: greywire | last post by:
So I need to load lots of data into my database. So I discover LOAD DATA INFILE. Great! This little gem loads my CSV in blazing times (compared to parsing the file and doing INSERT for each...
2
by: Vinciz | last post by:
hi guys... im new in java and i would love to learn some of these... basically i got a sample code to retrieve the blob from the mysql. however, i dont really know what to do with these...
6
Atli
by: Atli | last post by:
This is an easy to digest 12 step guide on basics of using MySQL. It's a great refresher for those who need it and it work's great for first time MySQL users. Anyone should be able to get...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.