Insert a Text file as Blob data into SQLite Database
<p>I created a db in sqlite with a table USER_DETAILS(USER_ID varchar,USER_NAME varchar,USER_INFO blob).I tried creating a file convert it into a byteArray and store it as a blob in the table.The db and the table got created but not the values. Here is my code .Can somebody pl guide on how to insert the blob data into the table?</p>

<p>create file :`String fileNameDb = fileName + mTextDocNo++;</p>

<pre><code>        FileOutputStream fis = (FileOutputStream) openFileOutput(
                fileNameDb, Context.MODE_PRIVATE);
        System.out.println("Create File " + fis);

        byte[] textFileArray = new byte[1024];
        int i = 0;
        while (i &lt; textFileArray.length) {
            fis.write(textFileArray);
        }
        System.out.println("Created the byteArray " + textFileArray);

        ObjectOutputStream oos = new ObjectOutputStream(fis);
        oos.writeChars(inputData);

        System.out.println("Calling the createNoteMethod------------&gt;&gt;&gt;");
        mDbHelper.createNote(fileNameDb, inputData + fileNameDb,
                textFileArray);
        oos.flush();
        oos.close();
        fis.close();
</code></pre>

<p>Insert stmt method :</p>

<pre><code>stmt = mDb.compileStatement("INSERT INTO USER_DETAILS VALUES(?,?,?)");
stmt.bindString(1, user_id);
stmt.bindString(2, user_name);
stmt.bindBlob(3, user_info);
stmt.executeInsert();
</code></pre>

<p>I get the below exception when i try creating the byteArray</p>

<blockquote>
  <p>03-14 17:07:07.674: WARN/System.err(613): java.io.IOException: No space left on device
  03-14 
  17:07:07.694: WARN/System.err(613):     at org.apache.harmony.luni.platform.OSFileSystem.write(Native Method)</p>
</blockquote>

<p>03-14 17:07:07.704: WARN/System.err(613):     at dalvik.system.BlockGuard$WrappedFileSystem.write(BlockGuard.java:171)</p>

<p>03-14 17:07:07.704: WARN/System.err(613):     at java.io.FileOutputStream.write(FileOutputStream.java:300)</p>

<p>03-14 17:07:07.715: WARN/System.err(613):     at java.io.FileOutputStream.write(FileOutputStream.java:256)</p>

<p>03-14 17:07:07.715: WARN/System.err(613):     at com.example.FileSharing.FileSharingActivity.createFile(FileSharingActivity.java:51)</p>
