File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Other Languages and the fly likes how to upload an audio file into MySql using SQL command Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Languages » Other Languages
Bookmark "how to upload an audio file into MySql using SQL command" Watch "how to upload an audio file into MySql using SQL command" New topic
Author

how to upload an audio file into MySql using SQL command

utsav gupta
Ranch Hand

Joined: Mar 19, 2009
Posts: 57
Hi

I have an audio file which I want to insert into a database using plain sql command. How do I do that?
I know its not a good idea to do that but the audio files are very small (hardly few kbs)
I understand that the files have to be converted into a binary stream and inserted in the form of BLOB but how do i do that is there an inbuilt function in MySQL to convert the file into BLOB?
I cannot use java or any other programming language just sql and windows batch commands.

Please reply.

Thanks
Utsav.
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

A simple search ...

INSERT INTO blob_tabl (some_col) values(load_file('/path/to/file'));

WP
utsav gupta
Ranch Hand

Joined: Mar 19, 2009
Posts: 57
wow!

I wonder how did i miss that in google!

Thank You William!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to upload an audio file into MySql using SQL command
 
Similar Threads
Problems with creating table in mysql through JSP
restoring database using sql file
How do you convert an stream in to Blob data?
Store word documents as blobs using base 64 encoding
How to pass BLOB to a PL/SQL Stored Procedure