Sw4   >   Sql   >   Sign In (Logon)
One of the most problem prone areas with creating and starting a new application is preparing the database and initially logging on to the database.
If you are using the Omnis data file, things are relatively simple because unlike read DB management systems, the Omnis data file doesn't support or enforce 'Users' and 'Permissions'.
Signing in (logging on) to a new database becomes a chicken-and-egg situation where we want StudioWorks to add a 'usr' table to the datatabase and insert a system administration user so that you can signin-in, but for StudioWorks to do this it needs to somehow logon to the database as the 'tables owner' database user.
Once you get the database setup with the tables owner user, the 'usr' table added, and a system administrator inserted into the 'usr' table you can easily 'Sign-In'... but getting there can be a headache.
This section explains how StudioWorks version 4 tries to making setting up a new database as simple as possible for the developer and very easy for the end users.With SQL92 compliant databases:
The superuser, tablesowner, and database user could all be the same user, however, experienced SQL92 developers have suggested to me that this is not a good idea.
It is important that we understand and use consistent terms when discussing users.
To simplify starting a new database StudioWorks version 4 has a number of defaults which you should use when setting up a new database. You can change the default passwords for higher security prior to releasing your application to the customer.
Note: To find the StudioWorks version 4 default users and passwords search the StudioWorks Wiki for 'Default Database Users'
The StudioWorks version 4 framework is designed to support having a database user for every application user.
The advantages of having a database user which matches each of application user are:
The disadvantages of having a database user which matches each of application user are:
If you choose the StudioWorks version 4 default of not adding a database user for every application user, the
window has to be able to open a session with the database logging on as the tables owner. The DBMS won't know about the application users so they can't directly logon to the database.To accomplish this without giving the users the actual tables owner name and password, StudioWorks version 4 allows the database administrator to create an encrypted tablesownerlogon.txt file which is stored in the startupsettings folder. On sign-in StudioWorks version 4 decrypts the file and logs on to the database as the tables owner. StudioWorks version 4 then fetches the application users from the Usr table and checks the user and password entered by the user against the list of application users. If a matching application user is found and the password matches the sign in process is completed and the main menu is installed and the main window is opened.
The tablesowner.txt file that ships with StudioWorks version 4 uses the default tables owner name and password. (To find the defaults ask the StudioWorks members list). If you use the defaults, you won't need to create a new encrypted file.
To create a new encrypted file:
This creates the encrypted file with the file path APP/startupsettings.tablesownerlogon.txt. The encrypted file contains the tables owner name and password. Encrption is done using the blowfish object.
Alternately you can store the tables owner logon information in a saved session as follows:
sessionname = TheUniqueSavedSessionName ;
StudioWorks version 4 tries to make preparing a new database a simple task... but be prepared for a few speed bumps to get in the way.
To prepare a new database.
Using the database vendor's tool:
Using your StudioWorks application:
You can preset any of the session properties for the default session which StudioWorks loads when your application is opened.
The startupsettings.txt file located in the APP/startupitems/ folder is where you can control the startup session properties.
StudioWorks checks for a startupsettings.txt file, and if found prepares a session row variable using the properties which if finds in the logonsettings{} properties group in the file.
The actual opening of a session with the database does not occur until after the user clicks the
button on the Sign-In window. This gives the user (or developer) an opportunity to change the session settings which are preset by the startupsettings.cfg file. The user can change the session or session settings by clicking the button on the Sign-In window.If the startupsettings file is not found or doesn't contain a logonsettings properties group StudioWorks simply uses the last selected session.
If there are no saved sessions the user will need to click the
button to open the window where they can create a session. See Sessions Manager for details on creating and modifying sessions.The following is sample logon settings text from a startupsettings.txt file
/*
----- Logon Settings -----
On starting up the application will check this file for any logon settings.
Any session properties specified in this configuration file will be used
for the initial logon session settings. If no settings are specified in this
file, the last session will be used.
-----
*/
logonsettings {
damname = FRONTBASEDAM ;
hostname = localhost ;
tablesownerlogon = TRUE ;
}