hraja77
asked on
db2 windows SQL1024N A database connection does not exist
i run the script and keep getting the error message in the title please help;
all i'm doing is a simple script to see if the database is up;
echo.
echo Check Database is running (start)
echo.
echo.
echo. Uses:
echo. %LOG_FILE%
echo. %DB2DATABASE%
SETLOCAL
set DB2DATABASE=%1
set LOG_FILE=%2
db2cmd /w /c /i DB2 CONNECT TO %DB2DATABASE%
db2 "select 1 from sysibm.sysdummy1"
set BACKUP_CHECK_LEVEL=%errorl evel%
if %BACKUP_CHECK_LEVEL% NEQ 0 (
echo.
echo *** Database could be down *** >> %LOG_FILE%
echo.
Exit 98
)
ENDLOCAL
echo.
echo Check Database is running (end)
echo.
echo.
all i'm doing is a simple script to see if the database is up;
echo.
echo Check Database is running (start)
echo.
echo.
echo. Uses:
echo. %LOG_FILE%
echo. %DB2DATABASE%
SETLOCAL
set DB2DATABASE=%1
set LOG_FILE=%2
db2cmd /w /c /i DB2 CONNECT TO %DB2DATABASE%
db2 "select 1 from sysibm.sysdummy1"
set BACKUP_CHECK_LEVEL=%errorl
if %BACKUP_CHECK_LEVEL% NEQ 0 (
echo.
echo *** Database could be down *** >> %LOG_FILE%
echo.
Exit 98
)
ENDLOCAL
echo.
echo Check Database is running (end)
echo.
echo.
ASKER
i still get the same error
ASKER
i actually get DB21061E Command line environment not initialized
Ahha. That's an entirely different issue. :)
The db2 environment is set up by running the db2profile. It was created when the db2 client, db2 connect, or the db2 server was installed on your computer.
By default, running command.com (or cmd.exe) does not run the db2 profile. You can modify your system so that it does, or you can run the command window from the script that was created by db2.
Start / All Programs / IBM DB2 / DB2COPY1 / command line tools / command window
Better yet, create a shortcut to it on your desktop.
Kent
The db2 environment is set up by running the db2profile. It was created when the db2 client, db2 connect, or the db2 server was installed on your computer.
By default, running command.com (or cmd.exe) does not run the db2 profile. You can modify your system so that it does, or you can run the command window from the script that was created by db2.
Start / All Programs / IBM DB2 / DB2COPY1 / command line tools / command window
Better yet, create a shortcut to it on your desktop.
Kent
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
db2 CONNECT TO %DB2DATABASE%
db2 "select 1 from sysibm.sysdummy1"