sybase connection through shell-script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers sybase connection through shell-script
# 1  
Old 03-03-2005
sybase connection through shell-script

Smilie how do i connect to sybase through shell script written in linux
# 2  
Old 03-03-2005
Impossible to write a shell script in Linux. Linux is the OS, not a shell.

Here is an example of a startup/shutdown script for Sybase:
Code:
#!/bin/sh
#
# Startup script for Sybase SQL server
#

#
# Adjust tcp's keepalive param to 10 mins for PCs which disconnect unexpectedly.
# Sun recommend that the value be set no lower than 10 minutes or performance
# may be affected.
#
/usr/sbin/ndd -set /dev/tcp tcp_keepalive_interval 600000

#
# Path to Sybase and install.
#
SYBASE=/usr/sybase

ISQL=$SYBASE/bin/isql

INSTALL=$SYBASE/install

export SYBASE ISQL INSTALL

case "$1" in
'start')
	#
	# Sybase server startup.
	#
	su sybase -c "$INSTALL/startserver -f $INSTALL/RUN_FOO -f $INSTALL/RUN_FOO_BACKUP &"
	;;

'stop')
	#
	# Sybase server shutdown.
	#
	$ISQL -S FOO -U sa -P password > /dev/console 2>&1 <<-'END'
	shutdown SYB_BACKUP
	go
	shutdown
	go
	END
	;;

*)
	#
	# Invalid param.
	#
	echo "Usage: /etc/init.d/sybase { start | stop }"
	;;
esac

# 3  
Old 03-03-2005
I am a bit confused with the reply.
Shell feature does not exist on Linux unline in UNIX?
# 4  
Old 03-03-2005
It's really simple - Linux is not a shell - it's a operating system. So it's impossible to write a 'linux' shell script. You can write shell scripts on a linux system but they would be one of the normal shells (sh,ksh,csh,bash,tcsh,...).
# 5  
Old 05-20-2005
su sybase -c command....

RTM,
Smilie what does the
su sybase -c "$INSTALL/startserver -f $INSTALL/RUN_FOO -f $INSTALL/RUN_FOO_BACKUP &"

command do? Would it allow me to change between several interface files (that contain the sybase host info)?

If so, I noticed that you had 2 of them, so does that mean that you can utilize 2 (or more) different interface files to use to connect with ISQL?


Thanks,
Harold Smilie
# 6  
Old 05-20-2005
Quote:
RTM,
what does the command do?
su sybase -c "$INSTALL/startserver -f $INSTALL/RUN_FOO -f $INSTALL/RUN_FOO_BACKUP &"
No clue - I don't know sybase! The assumption is that it starts both instances of sybase which I assume is the main database server and the backup service.
If it doesn't work with two -f instances, then create two different lines for each instead. The DBA who wrote this script doesn't work at my company anymore so I can't even ask him.
# 7  
Old 05-20-2005
I guess ..you are asking how to connect to sybase using shell script.

use here documents

ISQL -U -P -S -o output.txt ............ << EOF

Whatever you want to do in the sybase


EOF


The output will be written to that file specified with -o switch (in the above case --> output.txt).

Hope this helps.
Jingi
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Extract top 20 records from sybase db in shell script

Hi, I am new to advanced scripting. I need to get top 20 records from database (Sybase) with a condition that all Char/varchar columns should have more than 4 characters. I need to do this via shell scripting, I have got half logic (on how to get varchar/char columns and stored it in a... (2 Replies)
Discussion started by: Selva_2507
2 Replies

2. Shell Programming and Scripting

Sybase connection failing through shell script

Hi All, I'm trying to connect to Sybase via shell script. i'm getting the following error. Please let me know where i'm going wrong. Note that i'm not having this issue when connecting via terminal. #!/usr/bin/bash SYBASE=/usr/sybase ISQL=$SYBASE/bin/isql export SYBASE ISQL ... (6 Replies)
Discussion started by: Irishboy24
6 Replies

3. Solaris

Sybase Connectivity Check through Shell Script

Hi, I need to check the sysbase database connectivity through the Unix Shell Script. Can you help me on the how to write the script to test the sysbase database connection. Thanks in Advance Nandha (0 Replies)
Discussion started by: nandha2387
0 Replies

4. Shell Programming and Scripting

Executing Shell Script from Within a Sybase Stored Proc

Greetings, I need to make an open server call to a shell script from inside a Sybase Stored procedure. Coul any one please provide a sample code? TIA (0 Replies)
Discussion started by: rajpreetsidhu
0 Replies

5. Shell Programming and Scripting

Capturing Sybase SP output in Shell Script

Greetings, I need to capture the output of a Sybase stored procedure, inside my shell script( k shell). Based on this output, I need to call another perl script, with input arguments as the result set of the procedure execution. I need to keep looping through and call the perl script, ... (2 Replies)
Discussion started by: rajpreetsidhu
2 Replies

6. Shell Programming and Scripting

Sybase Connection Issue

I am trying this >$ /usr/sybase/bin/isql -UABC -Pdef -SXYZ -b Getting the following error. Help is appreciated (1 Reply)
Discussion started by: pinnacle
1 Replies

7. UNIX for Dummies Questions & Answers

How to authenticate sybase login thru shell script ?

Hi All, This is my first post. Need your favour guys. I need to authenticate syabse login/password thru shell script. I am getting the ID & Pwd form user and storing it in variable.. But how to authenticate and echo user back if the id/pwd doesnt work. isql -U$1 -P$2 -S$3 ?? thanks in... (3 Replies)
Discussion started by: libin4u2000
3 Replies

8. Shell Programming and Scripting

Connecting to sybase via shell script.

Hi All, I was able to connect to sybase in shell script and also able to run few sql queries, something like this, #!/usr/bin/ksh -x temp=`echo "select name from sysobjects where type = 'U'"` results=`isql -SDS_SERVER-UAdhocUser -Pha12 <<EOF set rowcount 6 $temp go EOF` line_count=0... (1 Reply)
Discussion started by: arvindcgi
1 Replies

9. Shell Programming and Scripting

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 (7 Replies)
Discussion started by: bhgopi
7 Replies

10. Shell Programming and Scripting

remote sybase connection and php error.

Hi all, I am trying to connect to a remote sybase database server (sitting on windows) from my freebsd apache webserver. My Webserver has installed; Apache2.0 PHP 4.3.8 Freetds with ODBC enables ( tsql works but isql doesnt ) unixODBC syabse-ocsd When i connect with tsql from... (4 Replies)
Discussion started by: lealyz
4 Replies
Login or Register to Ask a Question