On 13 Sep 2011, at 10:50am, jerome moliere wrote:

> I'm about trying to use SQLite as a pure in memory mode but I am still
> facing problems,
> I wrote a small Java program doing this:
> - opening a connection using the in memory syntax
> - create a stupid table
> - insert dummy values
> - dumping the table to a file
> - dropping the table
> - restoring the contents of my dumps
> - issuing a query on the table
> 
> my query fails because the table does not exist

If the table does not exist, then obviously you did not do all the above steps 
correctly.  What makes you think that the 'restoring the contents of my dumps' 
stage did its job ?

A good way to test things like this is to use the sqlite3 command-line shell 
tool:

<http://www.sqlite.org/sqlite.html>

Execute your commands in that.  If that works, but your Java code doesn't, the 
fault is in your Java code.   If the shell tool doesn't do your commands 
correctly, there's something wrong with the commands.

> So I guess should rather use such strategy, could you confirm/infirm it ?
> - connect as in memory
> - create the table mytable in memory
> - attach the database as stored in a file : attach database 'mydb' as mydb
> - import the data using a insert into mytable query using a select *
> from mydb.mytable
> - then use data available in memory in the database using select * from 
> mytable

You might want to start off with you forget memory mode entirely.  Just use the 
database from the file and make sure everything works.  Once you've got that 
working, and if that solution doesn't give you acceptable behaviour, /then/ it 
might be worth messing with in-memory databases.

Simon.
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to