|For a db2start command to be successful in a Windows 95, Windows 98, or Windows |Millennium Edition (ME) environment, you must either: |
|In addition, the user ID that is specified either during the logon or for |the db2logon command must meet DB2's requirements |(see note (NOTE2)).
|When the db2start command starts, it first |checks to see if a user is logged on. If a user is logged on, the db2start command uses that user's ID. If a user is not logged on, the db2start command checks whether a db2logon command has been run, and, if so, the db2start command uses the user ID that was specified for the db2logon command. If the db2start command |cannot find a valid user ID, the command terminates.
|During the installation of DB2 Universal Database Version 7 on Windows 95, Windows 98, and Windows |ME, the installation software, by default, adds a shortcut to the Startup |folder that runs the db2start command when the |system is booted (see note (NOTE_1) for more information). If |the user of the system has neither logged on nor issued the db2logon command, the db2start command will |terminate.
|If you or your users do not normally log on to Windows or to a network, |you can hide the requirement to issue the db2logon command before a db2start command by running |commands from a batch file as follows: |
| @echo off | db2logon db2local /p:password | db2start | cls | exit
|The drive and path where DB2 is installed is stored in the DB2 registry variable |DB2PATH. To find the drive and path where you installed DB2, issue the following |command:
| db2set -g db2path
|Assume that the db2set command returns the value c:\sqllib. In this situation, |you would store the batch file as follows:
| c:\sqllib\bin\db2start.bat
| del "C:\WINDOWS\Start Menu\Programs\Startup\DB2 - DB2.lnk"
|If you decide to use your own shortcut, you should set the close on exit attribute for the shortcut. If you do not set this attribute, |the DOS command prompt is left in the task bar even after the db2start command has successfully completed. To prevent the DOS window |from being opened during the db2start process, |you can create this shortcut (and the DOS window it runs in) set to run minimized.
|If you use a batch file to issue the db2logon |command before the db2start command is run, and |your users occasionally log on, the db2start command |will continue to work, the only difference being that DB2 will use the user |ID of the logged on user. See note (NOTE_1) for additional details.
|Note:
| db2logon userid /p:password
|The user ID that is specified for the command must meet the DB2 naming |requirements (see note (NOTE2) for more information). If the |command is issued without a user ID and password, a window opens to prompt |the user for the user ID and password. If the only parameter provided is a |user ID, the user is not prompted for a password; under certain conditions |a password is required, as described below.
|The user ID and password |values that are set by the db2logon command |are only used if the user did not log on using either the Windows logon window |or the Microsoft Networking logon window. If the user has logged on, and a db2logon command has been issued, the user ID from |the db2logon command is used for all DB2 actions, |but the password specified on the db2logon command |is ignored
|When the user has not logged on using the Windows logon window |or the Microsoft Networking logon window, the user ID and password that are |provided through the db2logon command are used |as follows: |
|The table is |created with a high-level qualifier as db2local.tab1. |
|You should use a user ID that is equal to the schema name of your |tables and other objects.
|To use the |DB2 Synchronizer application or call the synchronization APIs from your application, |DB2 must be started if the scripts that are download for execution contain |commands that operate either against a local instance or a local database. |These commands can be in database scripts, instance scripts, or embedded in |operating system (OS) scripts. If an OS script does not contain Command Line |Processor commands or DB2 APIs that use an instance or a database, it can |be run without DB2 being started. Because it may be difficult to tell in advance |what commands will be run from your scripts during the synchronization process, |DB2 should normally be started before synchronization begins.
|If you |are calling either the db2sync command or the |synchronization APIs from your application, you would start DB2 during the |initialization of your application. If your users will be using the DB2 Synchronizer |shortcut in the DB2 for Windows folder to start synchronization, the DB2 Synchronization |shortcut must be modified to run a db2sync.bat |file. The batch file should contain the following commands to ensure that |DB2 is running before synchronization begins:
| @echo off | db2start.bat | db2sync.exe | db2stop.exe | cls | exit
|In this example, it is assumed that the db2start.bat file invokes the db2logon and db2start commands as described above.
|If you |decide to start DB2 when the application starts, ensure that the installation |of DB2 does not add a shortcut to the Startup folder to start DB2. See note (NOTE3) for details. |