Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3339
  • Last Modified:

How to test the sybase connection.

Hai !
       we are pulling the data from a sybase remote machine.
Before extracting i need to test the sybase connection status. How to do this ?

How can we determine that the connection failed (sybase database down) ?
0
vishali_vishu
Asked:
vishali_vishu
1 Solution
 
navid86Commented:
If I understand the question properly, you need to check the ODBC connection.  This is under the control panel in Windows XP.  Control Planel > Administrative Tools > Data Sources (ODBC).

Under user DSN or system DSN you should see your ODBC connection.  Highlight your connection then click Configure.  At the bottom of the Configure screen there is a Test Connection button.  You can click that to test your connection.

Hope this helps!
0
 
grant300Commented:
I am betting that you are doing the data pull automatically in some kind of script and want to put a check of the Sybase connection into the process so you can tell what is wrong.  Since you specify Unix, I figure there is no ODBC.  That's O.K.; it actually makes things easier.

Since you are on a Unix/Linux platform, you will have the Sybase Client Library (CT-lib) and it's associated components installed.  On Windows machines there is a utility called "sybping" for testing connections but there is no equivalent on Linux or Unix.  The script below will do roughly the same thing using ISQL and some shell commands to determine success or failure.  I believe this was posted somewhere by Michael Peppler, a well know Sybase guru.  It looks like it might be a little rough yet.

Regards,
Bill



#!/bin/sh
 
srv=$1
logfile=/tmp/sybping.$$
isql -Usa -PTryItNow -S$srv >$logfile 2>&1
 
# ASE
grep 'Login failed' $logfile >/dev/null
if [ $? -eq 0 ]
then
echo "Server $srv is up"
exit 0
fi
 
# Generic message when connection fails.
grep "connect two endpoints failed" $logfile >/dev/null
if [ $? -eq 0 ]
then
echo "Server $srv is unreachable"
exit 1
fi
 
echo "Unknown sybping error:"
cat $logfile
exit -1

Open in new window

0

Featured Post

Get your Disaster Recovery as a Service basics

Disaster Recovery as a Service is one go-to solution that revolutionizes DR planning. Implementing DRaaS could be an efficient process, easily accessible to non-DR experts. Learn about monitoring, testing, executing failovers and failbacks to ensure a "healthy" DR environment.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now