#!/usr/bin/perl -w use strict; use DBI; use MIME::Base64; my $dbh = DBI->connect('DBI:SQLite:dbname=test_blob.db', '', ''); $dbh->do('CREATE TABLE test_blob( a text , b text , Bindata BLOB )'); my $bindata = "ABC" . qq|\x00| . "DEF"; #added $bindata = encode_base64($bindata); my $sth1 = $dbh->prepare('INSERT INTO test_blob VALUES(?,?,?)' ); my @ar = qw|foo doog|; $sth1->execute(@ar, $bindata); my $sth2 = $dbh->prepare('SELECT Bindata FROM test_blob'); $sth2->execute(); my $row = $sth2->fetch(); my $fetched_data = $row->[0]; $sth2->finish(); $dbh->disconnect; print decode_base64($fetched_data); 1;