2010-07-25

Pointing REAL Server (SQLite) to a database

REAL Server can serve many different databases simultaneously. You find a list of them on the Database sidebar item in the REAL Server Admin app.

One of the first things you need to learn when using the "Console" in the REAL Server Admin app is that you must tell the server which of these database you want to use. Even if you have only one database, you must consciously "point" the console session to that database. If you fail to point the console, any SQL command requiring a particular database will fail with an error. If that happens, the Admin app is usually good about reminding you to select a database.

To point the console session to a database, execute this sql:

USE DATABASE 'ExampleDbName'

Any more commands executed is this console session apply to that particular database.

To switch to another database, use that same command again:

USE DATABASE 'OtherDbName'

You can point the console away from any database. You may want to do this to avoid inadvertently executing commands against the wrong database.

To point the console away from any database, execute this SQL:

CLEAR CURRENT DATABASE

You receive no confirmation of this command. If you want to verify that the session points to no database, execute the following harmless SQL code to see if it generates a complaint about not pointing to a database, error # 7030. Strangely, the "SELECT DATETIME" command requires a database.

select datetime('now');

I do not know how to ask what database the console session currently points to. Please post if you do. When in doubt, call the USE DATABASE command to be sure.