Using SQLite

Since SQLite is a file based database, we ship a set of release files fully configured with a database file that is already loaded with default data. All you have to do is setup the web, make the Data folder writable and you're ready to go. You can edit the content of the site after you login.

Note: We now also have support for SQL CE which has the same benefits of file based deployment but also can work in Mediumm Trust hosting and it performs significantly better than SQLite.

The instructions below are only here in case you want to create your own database instead of using the one included.

The preconfigured db, mojo.db.config, is located at WebRoot/Data/sqlitedb/
In the same folder you will also find the sqlite3.exe command line tool for Windows.

Open a command prompt and cd into this folder

To create a new database:

type sqlite3.exe yournewdbname.db.config

next while at the sqlite prompt type:

.read initdb.config

this will initialize the database,

You'll need to put the full path to
this file in the SqliteConnectionString in the Web.config

then you should visit /Setup/Default.aspx to run the sql scripts.

Control C will exit the sqlite prompt.

Note that the use of .config for the db name is only to make the file protected by ASP.NET so it can't be requested using http.

IIS 7 64 bit Issue

When trying to use SQLite under 64 bit Vista or Win 2008 server with IIS 7, you may get an error about an invalid file in relation to the sqlite3.dll because it is a 32 bit dll. You can resolve this in IIS by going to the advanced properties of the application pool and setting "Allow 32 bit apps" to true.

Upgrading Notes

The mojoPortal deployment package for SQLite includes a database file located at /Data/sqlitedb/mojo.db.config

After you have a site running with SQLite, when you upgrade to a new version of mojoPortal you do not want to overwrite your database file with the one included in the mojoPortal package. So you can either download your current database file and then upload it again after you upload the new files, or probably a better approach is to unzip the mojoPortal package on your local machine and remove the database file from the package before you upload the new files.

Last Updated 2010-07-23 by Joe Audette

Rate this Content 3 Votes