Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Accessing remote database to return value

2 posts in General Discussion Last posting was on 2007-10-24 20:22:00.0Z
Herman Miller Posted on 2007-10-24 19:16:55.0Z
Sender: 4e4f.471f581a.1804289383@sybase.com
From: Herman Miller
Newsgroups: ianywhere.public.general
Subject: Accessing remote database to return value
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <471f9a27.5830.1681692777@sybase.com>
NNTP-Posting-Host: 10.22.241.41
X-Original-NNTP-Posting-Host: 10.22.241.41
Date: 24 Oct 2007 12:16:55 -0700
X-Trace: forums-1-dub 1193253415 10.22.241.41 (24 Oct 2007 12:16:55 -0700)
X-Original-Trace: 24 Oct 2007 12:16:55 -0700, 10.22.241.41
Lines: 23
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6478
Article PK: 2910

We have a need to access a remote database to check for a
value before executing a database event. The code is below.
I would like to have an if statement execute a
storedprocedure on the remote database to check for a value
of 1, if the value is zero the remaining code will not
execute. The issue I am having is how to execute a
connection to the remote database not on the same lan and
execute the sproc to check the value.

create event Start_Mobilink type DatabaseStart
enable handler begin
declare @vers char(10);
select max(version) into @vers from dba.ctr_central;

I WOULD LIKE TO HAVE AN IF STATEMENT HERE THAT RUNS A REMOTE
SPROC THAT CHECKS FOR A VALUE OF 1 BEFORE RUNNING THE CODE
BELOW

call xp_cmdshell('c:\lcos\db\dbmlsync.exe -c
"dsn=XXX;uid=remoteuser;pwd=remote" -k -q -x 100M -os 5M -o

c:\lcos\db\mobilink_123.log -e "sv='2.28'"', 'no_output' );
end;


Breck Carter [Team iAnywhere] Posted on 2007-10-24 20:22:00.0Z
From: "Breck Carter [Team iAnywhere]" <NOSPAM__bcarter@risingroad.com>
Newsgroups: ianywhere.public.general
Subject: Re: Accessing remote database to return value
Organization: RisingRoad Professional Services
Reply-To: NOSPAM__bcarter@risingroad.com
Message-ID: <80avh3521i3lhfvdiq5cd1h1hd62c4c6js@4ax.com>
References: <471f9a27.5830.1681692777@sybase.com>
X-Newsreader: Forte Agent 2.0/32.640
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: bcarter.sentex.ca
X-Original-NNTP-Posting-Host: bcarter.sentex.ca
Date: 24 Oct 2007 13:22:00 -0700
X-Trace: forums-1-dub 1193257320 64.7.134.118 (24 Oct 2007 13:22:00 -0700)
X-Original-Trace: 24 Oct 2007 13:22:00 -0700, bcarter.sentex.ca
Lines: 43
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub ianywhere.public.general:6479
Article PK: 4776

You should be able to use a "proxy procedure call" to do what you
want. The general topic in the Help is called "remote data access",
the specific topic is "remote procedure call", and you will be
interested in the CREATE SERVER and CREATE PROCEDURE ... AT commands,
and possibly CREATE EXTERNLOGIN.

Let us know if you have any specific questions about this.

Breck

On 24 Oct 2007 12:16:55 -0700, Herman Miller wrote:

>We have a need to access a remote database to check for a
>value before executing a database event. The code is below.
>I would like to have an if statement execute a
>storedprocedure on the remote database to check for a value
>of 1, if the value is zero the remaining code will not
>execute. The issue I am having is how to execute a
>connection to the remote database not on the same lan and
>execute the sproc to check the value.
>
> create event Start_Mobilink type DatabaseStart
> enable handler begin
> declare @vers char(10);
> select max(version) into @vers from dba.ctr_central;
>
>I WOULD LIKE TO HAVE AN IF STATEMENT HERE THAT RUNS A REMOTE
>SPROC THAT CHECKS FOR A VALUE OF 1 BEFORE RUNNING THE CODE
>BELOW
>
> call xp_cmdshell('c:\lcos\db\dbmlsync.exe -c
>"dsn=XXX;uid=remoteuser;pwd=remote" -k -q -x 100M -os 5M -o
>
>c:\lcos\db\mobilink_123.log -e "sv='2.28'"', 'no_output' );
> end;

--
Breck Carter [Team iAnywhere]
RisingRoad SQL Anywhere and MobiLink Professional Services
www.risingroad.com
The book: http://www.risingroad.com/SQL_Anywhere_Studio_9_Developers_Guide.html
breck.carter@risingroad.com