Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 5th, 2008, 11:35 PM
Mary Lei
Guest
 
Posts: n/a
Default load_file and blobs

I cannot update the blobs correctly with mysql.

I exported 3 rows from db2 to mysql database.
There are blobs in the database.
db2 display the 3 rows as
db2 'select cast(type_blob as varchar(200)) from ilwdtypes'

1




-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
x'969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 969696969696'


x'979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979797 9797979797979797979797'


x'989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898'


When I want to add the blob objects back to mysql after the data was
imported,
mysqlupdate ilwdtypes set type_blob=load_file('./lwdtypes.del.001.lob');

I ended up having the entire blob in each row of the column
mysqlselect hex(type_blob) from ilwdtypes where type_char_s =
"1216412567";
|
96969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 9696969696747970655F636C6F629797979797979797979797 97979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979774 7970655F636C6F629898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898987479 70655F636C6F62
|

How can I get mysql to update each blob properly to match the ones in db2 ?

db2 version 9.1.5 on 32 bit Linux
mysql on 32 bit linux Server version: 5.0.45 Source distribution

Thanks.

Mary
  #2  
Old August 6th, 2008, 12:55 AM
Mary Lei
Guest
 
Posts: n/a
Default Re: load_file and blobs

I found one solution :
I have to split up the lob file from db2 using the offset and size of
each lob into individual files and update each of the rows with the
split load file.
Tedious but works.

Mary Lei wrote:
Quote:
I cannot update the blobs correctly with mysql.
>
I exported 3 rows from db2 to mysql database.
There are blobs in the database.
db2 display the 3 rows as
db2 'select cast(type_blob as varchar(200)) from ilwdtypes'
>
1
>
>
>
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
x'969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 969696969696'
>
>
x'979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979797 9797979797979797979797'
>
>
x'989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898'
>
>
When I want to add the blob objects back to mysql after the data was
imported,
mysqlupdate ilwdtypes set type_blob=load_file('./lwdtypes.del.001.lob');
>
I ended up having the entire blob in each row of the column
mysqlselect hex(type_blob) from ilwdtypes where type_char_s =
"1216412567";
|
96969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 96969696969696969696969696969696969696969696969696 9696969696747970655F636C6F629797979797979797979797 97979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979797 97979797979797979797979797979797979797979797979774 7970655F636C6F629898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898989898 98989898989898989898989898989898989898989898987479 70655F636C6F62
|
>
How can I get mysql to update each blob properly to match the ones in db2 ?
>
db2 version 9.1.5 on 32 bit Linux
mysql on 32 bit linux Server version: 5.0.45 Source distribution
>
Thanks.
>
Mary
  #3  
Old August 6th, 2008, 10:25 PM
Erland Sommarskog
Guest
 
Posts: n/a
Default Re: load_file and blobs

Mary Lei (mlei@ligo.caltech.edu) writes:
Quote:
I found one solution :
I have to split up the lob file from db2 using the offset and size of
each lob into individual files and update each of the rows with the
split load file.
Tedious but works.
If you post to comp.databases.mysql, you might learn a better solution.
Since this newsgroup is a about different product, your prospects are
somewhat bleak here.o


--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles