Can we store .doc .pdf and .jpg files in SQLite Database (Android)? Can we store .doc .pdf and .jpg files in SQLite Database (Android)? sqlite sqlite

Can we store .doc .pdf and .jpg files in SQLite Database (Android)?


Yes, go ahead. It is easier to store every file in the database, than just using the database to keep track of where each file is.

If the files are small, performance should be fine. From the SQLite website:

... many developers are surprised to learn that SQLite can read and write smaller BLOBs (less than about 100KB in size) from its database faster than those same blobs can be read or written as separate files from the filesystem. (See 35% Faster Than The Filesystem and Internal Versus External BLOBs for further information.) There is overhead associated with operating a relational database engine, however one should not assume that direct file I/O is faster than SQLite database I/O, as often it is not.


I know we can store image files but for the above?

From the standpoint of SQLite, an image is no different than any other type of file. You are welcome to store file contents in a BLOB column. This may not be very efficient.

Even if we can store what will be the given max file size?

The limit of a SQLite database is something like 2TB. Your Android device will not have that much storage space.


SQLite is a liteweight component.Instead of storing files like .pdf and .doc in SQLite,store them in internal storage and get the path in internal storage and now store that in SQLite as a string.