Connect to sybase database using Korn shell script

Hi,

Can anyone please give me a script or let me know how to connect to a sybase database and execute a query using Korn shell scripts.Am new to Unix but i need to do this ASAP.

Please help.

Thanks,
Gops

Have a look here.

Hi thanks, but can you please let me know where to give the server details like ip or machine name.

Add -S to the isql call and include the server name.

isql -Uuser -Ppassword -Sserver <<EOF
your sql here
EOF

Hey Thanks it works..

Is there a way to directly write the result of a select query into a file or should we only loop through and write into file.

Gops

Isnt it answered in this post.

You have the queried results in the variable $results.

Use a echo $results > output.txt

vino

Missed it ...Thanks anyway

I would recommend doing the following when executing isql from a Unix script. It makes use of environment variable and avoids the displaying of passwords to those doing a ps -ef command.

isql -U$user -S$server <<EOF
$password
your sql here
EOF