To connect to sql-server database on defferent server using php
-
vendredi 9 mars 2012 06:06
Hi,
I am developing an application using programming language PHP and using data base MySQL.
Now i want to connect my application with SQL-server database which is on different server.
Because i want to insert some data in SQL-server database. I am using internet to establish connection b/w application
and SQL-server.
Please any body suggest me any idea how to do it !
Is it possible to connect to sql-server data base using ip address of remote server !!
Thanks !
- Déplacé Samuel Lester - MSFTMicrosoft Employee vendredi 9 mars 2012 06:42 Moving to PHP drivers forum (From:Getting started with SQL Server)
Toutes les réponses
-
vendredi 9 mars 2012 10:29
You can connect to any server, the first parameter of sqlsrv_connect() selects it, e.g.:
// Connect to IP address 1.2.3.4 on port 2000: $conn=sqlsrv_connect('1.2.3.4,2000', $params); // Connect to IP address 10.20.30.40 on port 1433: // (you don't need port if it's for default instance) $conn=sqlsrv_connect('10.20.30.40', $params); // Connect to a default instance on server // with computer name MYSERVER: $conn=sqlsrv_connect('MYSERVER', $params); // Connect to a named instance MYINST on a // server with computer name MYSERVER: $conn=sqlsrv_connect('MYSERVER\\MYINST', $params);
Rob
- Proposé comme réponse Jonathan GuerinMicrosoft Employee lundi 12 mars 2012 22:15
- Marqué comme réponse Jonathan GuerinMicrosoft Employee vendredi 23 mars 2012 16:58
-
vendredi 9 mars 2012 11:55
You can connect to any server, the first parameter of sqlsrv_connect() selects it, e.g.:
// Connect to IP address 1.2.3.4 on port 2000: $conn=sqlsrv_connect('1.2.3.4,2000', $params); // Connect to IP address 10.20.30.40 on port 1433: // (you don't need port if it's for default instance) $conn=sqlsrv_connect('10.20.30.40', $params); // Connect to a default instance on server // with computer name MYSERVER: $conn=sqlsrv_connect('MYSERVER', $params); // Connect to a named instance MYINST on a // server with computer name MYSERVER: $conn=sqlsrv_connect('MYSERVER\\MYINST', $params);Thanks a lot !
Actually i am first time using sql-server ,so confused something.
In fact what i want here is that , to save data in a .net application from a php application.
That .net application is not providing any web service neither giving any option to write web service .
So i am using this way for communication.
so i have to insert some data in sql server .
am i on write track ? or it can be done in some other way ???
thanks !
Rob
-
lundi 12 mars 2012 02:22
I don't know... but I can confirm that there's nothing wrong with your idea at all, and there are always many different ways to solve problems - that's why it's fun to program computers.
Good luck!
Rob

