Page 1 of 1

Create db on the fly.

Posted: Mon 24 Jan 2011 18:56
by scope_creep
Is it possible to create a database when it's opened, and then create tables/indexes on the fly.

I have a class library that needs to create the database, create the tables, and then populate the tables.

And then the db will be read by an external program. Essentially i'm filling it with xml that needs to be cache, and then the external program reads the messages from db, and send them across a transport, wcf maybe.

Can it be done.
Any help would be appreciated.
Bob.

Posted: Tue 25 Jan 2011 15:32
by AndreyR
Take a look at the FailIfMissing connection string property.
If it is set to false, a new database file is created with an empty database in it. Then you can execute ADO.NET commands to create the database objects.
Are you using any ORMs (Entity Framework or LinqConnect)?

Posted: Tue 25 Jan 2011 17:53
by scope_creep
Hi AndreyR,
I saw that property. I've decided to create the database schema before hand using SQLiteStudio. It seems to be a better approach and SQLiteStudio seems reasonably decent.

The main question though is it possible to have db opened using your driver from two seperate processes. I have 1 app populating it a single table with xml messages, and another program (c# wcf) reading the same table and removing the xml messages and sending them to central db probably oracle.

Posted: Wed 26 Jan 2011 11:22
by Shalex
Yes, one database can be used by several separate processes. Please use the Locking=Normal; (default) connection string parameter.

All connection string options are available here.

Multiprocess access.

Posted: Thu 03 Feb 2011 15:39
by scope_creep
Excellent.
That was what i've been looking for.
Thanks
Bob.