How to write a program in c to upload file onto mysql database?
lauky asked:
I can use mysql C api’s
i want to upload file using C prg in BLOB field of mysql database.
I am able to successfully upload other data varchar, date, time, no and also can estabalish sql connection.
Comments on How to write a program in c to upload file onto mysql database?
October 3, 2008
go bubba go @ 8:48 pm
First you open a connection to the database and pass it any necessary credentials. Once you have a connection object, you use the mysql APIs to encode the necessary SQL to insert your data into the database. Keep in mind that it may be more efficient to simply store the relative file paths in the database, and leave the files somewhere unmolested on the file system. If you truly need the entire file uploaded into the database, make sure you are putting it into a BLOB or TEXT field.
Comments on How to write a program in c to upload file onto mysql database?
First you open a connection to the database and pass it any necessary credentials. Once you have a connection object, you use the mysql APIs to encode the necessary SQL to insert your data into the database. Keep in mind that it may be more efficient to simply store the relative file paths in the database, and leave the files somewhere unmolested on the file system. If you truly need the entire file uploaded into the database, make sure you are putting it into a BLOB or TEXT field.