Create db on the fly.

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
scope_creep
Posts: 12
Joined: Mon 24 Jan 2011 18:21

Create db on the fly.

Post by scope_creep » Mon 24 Jan 2011 18:56

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.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 25 Jan 2011 15:32

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)?

scope_creep
Posts: 12
Joined: Mon 24 Jan 2011 18:21

Post by scope_creep » Tue 25 Jan 2011 17:53

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.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Wed 26 Jan 2011 11:22

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.

scope_creep
Posts: 12
Joined: Mon 24 Jan 2011 18:21

Multiprocess access.

Post by scope_creep » Thu 03 Feb 2011 15:39

Excellent.
That was what i've been looking for.
Thanks
Bob.

Post Reply