版次注意事項


|14.1 Starting DB2 on Windows 95, Windows 98, and Windows ME When the User Is Not Logged On

| |

|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: |

  1. |Create a batch file that issues the db2logon |command followed by the db2start.exe command. |For example:
    |  @echo off
    |  db2logon  db2local /p:password
    |  db2start
    |  cls
    |  exit
  2. |Name the batch file db2start.bat, and store |it in the /bin directory that is under the drive |and path where you installed DB2. You store the batch file in this location |to ensure that the operating system can find the path to the batch file.

    |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
  3. |To start DB2 when the system is booted, you should run the batch file |from a shortcut in the Startup folder. You have two options: | |

|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:

  1. |The db2logon command simulates |a user logon. The format of the db2logon command is:

    |  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: |

  2. |In Version 7, the user ID that is either used to log on or |specified for the db2logon command must conform |to the following DB2 requirements: |

  3. |You can prevent the creation of the db2start shortcut in the Startup folder during a customized interactive |installation, or if you are performing a response file installation and specify |the DB2.AUTOSTART=NO option. If you use these options, there is no db2start |shortcut in the Startup folder, and you must add your own shortcut to run |the db2start.bat file.

  4. |On Windows 98 and Windows ME an option is available that you can use to specify a user |ID that is always logged on when Windows 98 or Windows ME is started. In this |situation, the Windows logon window will not appear. If you use this option, |a user is logged on and the db2start command will |succeed if the user ID meets DB2 requirements (see note (NOTE2) |for details). If you do not use this option, the user will always be presented |with a logon window. If the user cancels out of this window without logging |on, the db2start command will fail unless the db2logon command was previously issued, or invoked |from the batch file, as described above.

  5. |If you do not start DB2 during a system boot, DB2 can be started |by an application. You can run the db2start.bat |file as part of the initialization of applications that use DB2. Using this |method, DB2 will only be started when the application that will use it is |started. When the user exits the application, a db2stop command can be issued to stop DB2. Your business applications can start |DB2 in this way, if DB2 is not started during the system boot.

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


[ 頁面頂端 | 前一頁 | 下一頁 | 目錄 | 索引 ]