General discussion

Locked

how to Connect SQL database from server2005 over dyndns in php

By kurakar ·
Dear all,

How to connect SQL Database from Server 2005 through dyndns in php,

My dyndns address - xxx-xxx.dyndns.org
Port - 3389(default)

This is the code:

PHP Code:

$dsn = 'DRIVER={SQL Server};SERVER=xxx-xxxx.dyndns.org:3389\SQLEXPRESS;DATABASE=XXXXXXX';
$connection = odbc_connect($dsn,'sa','xxxxxxx') or die('ODBC Error:: '.odbc_error().' :: '.odbc_errormsg().' :: '.$dsn);

Error Showing Like this:

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC SQL Server Driver][DBNETLIB]Invalid connection., SQL state 08001 in SQLConnect in C:\wamp\www\qamaruae\components\com_amc1234\views\amc1234\tmpl\statement.php on line 3
ODBC Error:: 08001 :: [Microsoft][ODBC SQL Server Driver][DBNETLIB]Invalid connection. :: DRIVER={SQL Server};SERVER=xxxx-xxxxx.dyndns.org:3389\SQLEXPRESS;DATABASE=xxxxxxxxxxx


Please help me.

This conversation is currently closed to new comments.

5 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Assuming there is a firewall as part of this configuration

by robo_dev In reply to how to Connect SQL datab ...

then there would need to be a firewall rule to allow inbound traffic on port 3389.

It would be logical to first test it using the IP address of your server, then work on using a dynamic DNS forwarder once that test was successful.

Collapse -

HELP ME

by kurakar In reply to Assuming there is a firew ...

Hi,

I used Server IP Address and checked in server itself its working, but i am checked with my system using ip address showing the error

Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied., SQL state 08001 in SQLConnect in C:\wamp\www\qamaruae\components\com_amc1234\views\amc1234\tmpl\statement.php on line 3
ODBC Error:: 08001 :: [Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied. :: DRIVER={SQL Server};SERVER=192.168.x.xx/SQLEXPRESS,1433;DATABASE=xxxxxxx

Collapse -

HOW ?

by Tony Hopkinson In reply to HELP ME

So which is it? Does not exist, which means wrong, name , turned off, or can't reach it.

Or access denied?

Start at the database server.

Can you do an ODBC connection while on the machine using that server instance name and the user/password or integrated log on you are using in the PHP script (I'm assuming yu've properly hidden these details in your connection string).

Confrm / get that bit right, then depending on your network topology try and ODBC test from an other PC on the same network.
If it doesn't happen, that could be TCP/IP isn't allowed (Surface Area config), windows firewall is on and ports 1433, and 1434 are blocked. It could be that they ae configure to use different ones!

The only way we can really help is by telling you to start at the begining and work your way towads the point of failure, the number of reasons you might get a faulure are hugely dependent on your infrastructure.

Sheesh you could have an unrecognised user trying to reach a machine somehwere else through a network path that doesn't exist using a protocol that's blocked.
Roll sleeves up, get weaving, the answer to your difficulties will only be easy after you've found it.
Generally with 20/20 hindsight these tend to be heart breakingly obvious.

If all this is flying over your head, get learning, trained or help (one of your network admins). We can't give you specific help, blind, well we can but it probably won't help.

Currently you are in dumb user mode, keeping pressing the button and hope the print out apears even though it's powered off. Put the tech head back on and apply your debugging skills to another environment.

Collapse -

PS another clue for doesn't exist versus access denied

by Tony Hopkinson In reply to HOW ?

is how long does it take to get a response, if it's quick it's likely to be access denied, if it's 15 seconds or more the it can't reach or some reason.

Not always true though, there could be a bottleneck in the connection path as well...

Could even end up being both....

Collapse -

Could be a few things that

by Tony Hopkinson In reply to how to Connect SQL datab ...

Make sure you can connect without dyndns.

SQL2005 also uses the the SQLBrowser service, by default on Port 1434.

A quick chance at it working or at least more info would be to put the port in as well, default is 1433

e.g.
...389\SQLExpress,1433; dataBASE...

Back to Networks Forum
5 total posts (Page 1 of 1)  

Related Discussions

Related Forums