Here's the code:
(defun sqlite3 (file) (interactive "fDB file name:\n") (term-send-string (ansi-term "bash" "sqlite3") (format "sqlite3 %s\n" file)))