Page 1 of 1
How to call stored procedure in another server
Posted: Wed Jul 07, 2010 3:55 pm
by emmbec
Hi, I have an application running on a web server (Server 1). What I want to do, is create a trigger on a table of a database located in Server1 which calls a stored procedure located in a Server2, which will store some value in the database of server2. Is this possible? Or do I need to put both databases in the same server?
Thanks!
Re: How to call stored procedure in another server
Posted: Sat Jul 17, 2010 5:55 am
by DaiLaughing
Without knowing what technologies you are using this is a bit of a stab in the dark but in principle there is not problem.
I use PHP and MySQL and (as with any other Web access to a database I expect) you need to connect to the database from the PHP script. To connect to a remote server database you just replace localhost with the address of that server. That server would have to be willing to accept remote connections of course. You would have to create and drop connections as required by the script to access the local and remote servers
Re: How to call stored procedure in another server
Posted: Sat Jul 17, 2010 12:42 pm
by emmbec
Hi, I guess I didn't make myself clear, I actually I don't want to use any PHP code or any other language whatsoever, I want to call the SP directly from a trigger in the MySQL table. The only sollution I've found is to have both databases located on the same server...
Re: How to call stored procedure in another server
Posted: Sat Jul 17, 2010 1:28 pm
by DaiLaughing
It might well be my mistake. I saw "I have an application" and assumed a web app. Sorry, tunnel vision.