Recently, one of mycert’s internal project required that PDF files to be saved into the database (MyQL). Since its is not easy to find the sample code via Google, here’s a quick note for future reference.
fContent = File.open("/path/file", "wb").read()
db = Mysql.new('localhost', 'user', 'password', 'database')
st = db.prepare("insert into tableA( fieldBlob) values (?)")
Another thing is that the max file size for blob is 64k. To store more than that, one […]