I'm using dbisql to connect to Sybase IQ database.
script is this below:
RESULT=$(dbisql -c "uid=dba;pwd=aaaaaa;eng=${ENGINE_NAME}" -onerror continue -nogui read ./dbScript/load_A_L_ART_PORT_D.sql [$FILE_NAME])
echo $RESULT |grep -q "SQLCODE"
if [ $? -eq 0 ]
then
write_log "[File]: ${FILE_NAME} import failed ..." ${LOG_NAME};
write_log "ERROR Message: ${RESULT}" ${LOG_NAME};
else
mv $FILE_NAME ${FILE_NAME}_imported
mv ${FILE_NAME}_imported $IMPORTED_DIR
write_log "[File]: ${FILE_NAME} import succeed ..." ${LOG_NAME};
write_log "Import Message: ${RESULT}" ${LOG_NAME};
fi
while database is running, everything works fine. but when database is shutdown. Error occurs:
[2] Please input database engine name[eng].(eg:iqcoor_zdc)
INPUT:
iqcoor_zdc
[1/50]Importing A_L_ART_PORT_H ...
**Could not connect to the database.
Database server not found
SQLCODE=-100, ODBC 3 State="08001"**
how to check if the database is running before execute the sql scripts? or other connection problems.
thanks!
You can test whether the IQ server is running by using the 'dbping' utility.