Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2012
    Location
    India,Mumbai
    Posts
    34

    Unanswered: connectivity to sybase

    Hi All,
    Can you please tell me the various ways to connect to Sybase from UNIX shell scripts besides the isql command.

  2. #2
    Join Date
    Aug 2011
    Posts
    10
    alrighty, if you are trying to connect to the database using the shell script use this bellow method, again this is via isql. This the only utility that lets you connect to Sybase Dataserver according to my knowledge. If you want to fully automate your tasks you may have to hard code your password or see a way to promptly securing it either referencing it in a global variable defined in .profile, where Sybase is installed or other methods. If you don't do this, the script asks for the password and you cannot run it in unattended mode like scheduling this job in crontab.

    #/usr/bin/env/bash +B
    #Shell script to connect to Sybase DB

    isql -Uuser_name -Sserver_name -Ppassword -Ddesired_user_DB -oOutput_file_name<<EOF>>
    sp_helpdb
    go
    select count(*) from sysobjects where type like "%U%"
    go
    EOF

    Also, if you have these set of sql commands saved in another file, you can simply pass the name of the file along with -i{file name} with the isql.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •