If you want to store files in a database using Java, you're better off
not using SQLite

None of the Sqlite JDBC drivers support streaming bytes to and from
the database. You have to load the entire file into memory and store
it in the database using setBytes(), and retrieve it using getBytes()

Unless your files are small enough for this not to matter, i'd
recommend using H2 instead (its a java-based SQL database that does
support the getBinaryStream/setBinaryStream JDBC methods)

Erin

On Mon, Apr 5, 2010 at 10:12 AM, Simon Slavin <slav...@bigfraud.org> wrote:
>
> On 4 Apr 2010, at 9:47pm, Andreas Henningsson wrote:
>
>> So my question is. How do I store files in the database from Java? Is
>> it possible. I hope so. I don't want to change database.
>> Is there some other way to do this that work?
>
> I don't know if your Java method of using SQLite allows this, but the normal 
> way to store a long stream of bytes inside a SQLite database would be to 
> define a column of type BLOB.  So look up whatever you can about the use of 
> BLOB columns.
>
> Simon.
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to