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 log in.

Note: We now also have support for SQL CE which has the same benefits of file-based deployment but also can work in Medium 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, or go to the folder in Explorer, click in the navigation bar and type "cmd" and hit enter, this will bring a command prompt up pointing to that 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.

CTRL+C will exit the SQLite prompt.

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.

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

When you upgrade to a new version of mojoPortal after you have a site running with SQLite 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 Modified by Elijah Fowler on Mar 15, 2017
Rate this Content 3 Votes