Maybe I got this totally wrong but I believe you can put MP3, video etc in a blob column. How do I insert it? I believe mp3.com uses mysql to ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
1. ## inserting into BLOB column type

Maybe I got this totally wrong but I believe you can put MP3, video etc in a blob column.

How do I insert it? I believe mp3.com uses mysql to store there mp3 files.

Can anyone help me?

2. Same way you would text data:

INSERT into <table> (blob_col) values ('data here');

With something like perl you could just do this:

open(FILE, "/path/to/file");
$blob=<FILE>;$query='insert into blob_table (blob) values (?);';
$sth=$db -> prepare($query);$sth -> execute($blob); 3. Thanks Genlee Is there a way I can specify a path into the Insert command? Something like Insert into mytable mp3column values(\path\to\mp3\)? Let's say that I have all my files on the same box but in a different directory. What is the best way of doing this without using script 4. INSERT INTO blob_tabl (some_col) values(load_file('/path/to/file')); ; 5. In that case, the easiest way to automate it is probably to run this command: Code: &#40;for file in /path/to/files/*; do echo 'INSERT INTO blob_tabl &#40;some_col&#41; values &#40;load_file&#40;'\'"$file"\''&#41;&#41;;'; done&#41; | mysql -D some_db -u some_user -p

6. Thanks guys, I will give that a go. Is there a special way to extract it as well? Lets say that I want to extract it to an other folder. Can I do this with a select statement?

Cheers

7. Use my program DBloader (engine) on my page (the link below) to load info of music or ftproot structures (or any other structure) in to mysql,mssql,postregsql..

you can easily modify it to load the mp3-file like a blob instead, if you need any help with that just let me know. Or if you have questions about the program.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•