LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to update a blob database field in DB2.

I am attempting to transfer a jpg image contained in a SQL server database to a blob field in a DB2 database. I am able to read the image data from the SQL server and I currently have the variant data converted to a string. Now I need to place this jpg's string data into the DB2 blob. How do I do this? Should I be converting the jpg image to a string?
 
Note: All connections to the databases are through ODBC.
0 Kudos
Message 1 of 8
(6,772 Views)
you should convert the jpg file to a string and then change the string throug labview
----------------------------------------------------------------------------------------------
There are 10 kind of persons. Those who understand binaries and the others.
0 Kudos
Message 2 of 8
(6,765 Views)

Hello MCP,

As I stated in my original post, I have already converted the jpg file to a string. What do you mean by "and then change the string throug labview"? How can I now update the blob field in db2 with the string data which is the content of the jpg image?

 

thanks

0 Kudos
Message 3 of 8
(6,758 Views)
But String only allow you 255 length.
Image convert to string will longer than 255 length. that's still a problem
http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 4 of 8
(6,672 Views)

hi there

Qia.sky is right. you have to use an appropiate datatype for the field. e.g. in MS Access you use the "Memo" datatype. to write to a database field see attachment.

Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 5 of 8
(6,666 Views)
chrisger
your way is good.
maybe we could use update method to finish the job.We may don't use string or memo, just treat it like binary format.then write or update it directly into database using SQL like this UPDATE Table SET Data=? WHERE Name=XXX;

But I still have a question
How to update two data of database, for example, there data1 and data2 need to be update
http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 6 of 8
(6,662 Views)
reference post
http://forums.ni.com/ni/board/message?board.id=170&message.id=142184&requireLogin=False
http://www.vitst.com
Virry Test & Control
LabVIEW Certified Developer
0 Kudos
Message 7 of 8
(6,659 Views)
you can use the update(fields[], values[]) method for several fields in one single recordset like shown in the atttachment, but this may cause some overhead because of the variant datatype and the large amount of data. if you use the first vi i posted you have to call the update() method before you change the recordset.
 
i don't like the SQL-statements that much because sometimes the error messages are quite generic, though the performance seems to be better.
Best regards
chris

CL(A)Dly bending G-Force with LabVIEW

famous last words: "oh my god, it is full of stars!"
0 Kudos
Message 8 of 8
(6,653 Views)