473,320 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Connecting Php with MSSQL server 2008 remotely

Hi,
I have to connect php with MSSQL server 2008 over other network.
Router is used in between and port number 1433 is forwarded to IP of the machine .
When i attempt to make connection without using router, I am able to make connection and when router is used,connection is made but database is not selected.
Error "unable to select database".
below is code of my connection.

$a=mssql_connect('1.23.182.244\SQLSERVER','Uname', 'Pass');

where 1.23.182.244 is the ip of router from where port no. 1433 is forwarded to other machine where sql server is installed.
SQLSERVER is the name of instance.

Thanks in advance.
Oct 10 '11 #1
3 5028
ck9663
2,878 Expert 2GB
Trying adding the default database on your connection string. When you said without using the router, do you mean your PHP is in the same machine as your db?

~~ CK
Oct 10 '11 #2
No friend,
Both are on different network.
but in that case i din't forwarded port to machine i mean i din't used router.
both were on different network and we din't used router.
and connection was established and data was retrieved.
but when router is used connection is established but database is not selected.
Oct 10 '11 #3
Hi,
My problem is solved.
Here I am explaining how to connect php with MSSQL server(which is behind router) over other network.

PC1:php installed.
PC2:mssql server installed.

steps are as follows.
on PC1 you have to:

1.check where is your php.ini file which is being used using phpinfo() in a php page.
2.comment in extension=php_mssql_dll.
3.Download a ntwdblib.dll file from internet and copy it to C://wamp/php and C://wamp/apache2/bin.

on PC2 you have to:

1.enable remote connection.
2.open configuration manager and enable TCP/IP port and enable all IP address under ip address column.Also put 1433 in TCP port row.
3.check whether port 1433 is running sql service or any other by typing netstat -aov | find ":1433".From here you will get PID of service which you can check in task manager.

Now open router and open port forwarding.
forward port 1433 to IP of PC2.
And also check network configuration which is very important.
Properly check DNS and gateway because these took my 1 day to make connection.
Also turn off firewall.
If you don't want to turn it off then configure firewall to allow sql service.
I am also new in this area and if you can't get what I said please let me know.
I hope this is enough for a remote connection.
Oct 12 '11 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Lenny Palozzi | last post by:
I'm looking for a way, via C/C++ code, to find the hostname and/or ip address of the MSSQL database server. I'm using the ODBC interface which, given a DSN and user/password allows me to connect...
1
by: Water Cooler v2 | last post by:
I am not able to start the MSSQL Server service on my system ever since I shifted my house and got a new network provider. Earlier, I was on the local cable hub, now my computer is on a DSL...
0
by: SonGoten13 | last post by:
Hi The situation is that i should check on my intranet-page the rights of the user to decide wich information he can access. I have to use the Windows Login Information(User/pw). I found out that...
14
by: Kukurydz | last post by:
I've got such problem: My database is stored on MSSQL Server. I have to write reports for it in MSAccess. I've got a problem with creating a query which will select records from MSSQL table with...
1
by: karoto | last post by:
Dear sirs Recently i was make a Web Site writen in asp workspace. I use this string to my web.config file to connect to my mssql 2000 server. <add key="ConnStringSQL" value="Network...
1
by: bhakti | last post by:
hi all, i have a php application connecting to mssql server 2005. i want to generate sql script for backing up a table with create statement and complete inserts. i dont want to use data publishing...
0
by: aleu | last post by:
Hi, I was wondering whether any of you is monitoring MSSQL server 2005 (whatever information could be obtained) from a remote Linux server with the use of SNMP or WMI-perl scripts (for example...
0
by: ruchika mahajan | last post by:
Hi all...MSSQL serevr 2000 Trace Event Column ObjectType gives value 17 for object table for events Object:Created and Object:deleted.Can anyone tell me all the possible values for MSSQL 2000 Trace...
0
by: IT Couple | last post by:
Hi 1) Question one I'm installing SQL Server 2008 Enterprise Edition on Windowds XP (remotely) and in the 'readme' file it tells me to install SP1 first and then SQL Server 2008 but when I try to...
2
by: Vikram Raman | last post by:
Hello Everyone, I have developed a web application in asp.net with C# in visual Studio 2005. And i used sql server 2008 as back end. When i run the program, it shows the following error.....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.