Can't connect to Sql Server 2000

P

pedroalves

Hi all!
I have am developing an application that connects to an SQL Server
directly. I have a dedicated server machine, a laptop for development
and an ipaq 3760 (windows mobile 2002). This device doesn't have wifi,
so I have to use activesync through usb.

* All goes fine in this development setup. *

Today, I brought the laptop and the pda to test on a production server,
just to see if I could connect ok, and as usual, problems arrise...

I can't connect to this SQL server...

The program is developed with .NETCF 1.1 sp3 in c#.

Running the application on the emulator, on the same machine that
serves the activesync link, I get an exception stating:
"SQL Server does not exist or access denied."

If I try to connect with the pda on the craddle, I get:
"General network error. Check your network documentation."

and off the craddle:
"Specified SQL server not found: SRV"

Here is the connection string:
"server=SRV;database=JONOB;user id=sa;password=;";

I have also tried, among other variations, to connect to the ip of the
server with:
"server=192.168.1.50;database=JONOB;user id=sa;password=;";

I have mada a simple test program using .net full version making the
same steps as in the cf verision,
and running on the computer that is hosting the activesync it connects
ok. Basically was this:

SqlConnection connection = new SqlConnection();
connection.ConnectionString = "User ID=sa;Initial Catalog=Jonob;Data
Source=SRV";
connection.Open();

Using Ethereal, I can see that there is some traffic going on between
the laptop and the server when I try to connect on the pda. I guess I
don't see the pdas ip, because the laptop is doing network address
translation.

I can access the internet on the pda, but I can't access any network
folder.
On the (Windows Mobile 2003) emulator, I can browse network shares, but
also cannot connect to the server.

There are no firewalls involved.

I have on Settings / Connections set the "My network card connects to:"
-> The internet
and enabled pass-through for this connection in ActiveSync on the pc.

I see that the pda resolves the address of the server, because when I
ping with vxUtil the address "SRV", it resolves the ip, but gets no
reply. Again, the laptop can ping the server. Is this normal?

- Why I am getting this weird behaviour?
- Why can I connect to network folders on the emulator, but can't on a
real device?
- And most important of all, why, oh why can't I connect to this
server!?!?!

I've been googling all day, and I see a lot of people seing this
"General network error" on the .net desktop version, but those appear
after connection, so they don't seem related.
Sorry for such a long post...

Thanks in advance,
Pedro Alves
 
S

Sergey Bogdanov

This error arises because there is no connection between SQL Server and
your device - as you stated you can't ping to SQL server. It seems that
there is no packet routing from your device to local network. I suggest
you to try to connecting via global IP of your SQL server:

User ID=sa;Password=;Initial Catalog=Jonob;Data
Source=SQLServerExternalIP

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
P

pedroalves

Hi,

Well, I can't ping to the SQL server from inside the PDA when it is
connected to my pc through activesync/usb, but I can ping the server
and connect to it from the laptop. The server has only one network
interface, the local one.

+----------------------+
| PDA (192.168.50.101) |
+----------------------+
|
(ActiveSync)
|
+------------------------+
| Laptop (192.168.1.150) |
+------------------------+
|
(Ethernet)
|
+--------------------+
| SRV (192.168.1.50) |
+--------------------+

I don't know how to install vxUtils to the emulator, so I can't test
for pings there.
If I swap the pda for an emulator in the previous configuration, I am
able to browse to //SRV/C, which I couldn't from the pda. Again from
the laptop, all connects fine.

I have a very similar setup on my office, that has no problems, that's
why this was a surprise to me.
The windows sharing is in workgroup mode, both in my office, and at the
production site.

I guess there is just something obvious that I can't see...
Thanks again,
Pedro Alves
 
S

Sergey Bogdanov

I suppose PDA & SRV are placed in different subnets (am I right that
your mask is 255.255.255.0?) and it is possibly the problem. That is why
I suggest you to use global IP to connect to SQL server or implement
routing between 192.168.1 and 192.168.50 subnets in your laptop.

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
P

pedroalves

The mask are indeed 255.255.255.0. Yes the pda is on a different
subnet,
but it is only so because ActiveSync opens a ppp connection with the
pda, and assigns it's own subnet to talk to the pda. ActiveSync then
perform the NATting (or in ActiveSync's terms - pass-through), so the
pda can talk to the outside world with tcp/ip. I don't see how I can
control the ips between the laptop and the pda.
In my office, I have the same setup, no public ips, the pda gets the
same ip assigned by the same laptop, and there I can connect to (a
different) server.
In my office I have:
pda always gets 192.168.50.101
laptop has 192.168.50.100 for ActiveSync connection with pda,
also has network iface with 192.168.199.203
and the server has 192.168.199.215

not so different...

So, the only difference seems to be the server... In my office I hava
an Sql Server Desktop Edition, and at the production site it's an
Enterprise Edition. Could this make a difference?

Sorry for the insisting on this, but I really must get this fixed.
Thanks,
Pedro Alves
 
C

Code_Joe

I had a similar problem and I looked on the web and found an article
telling me to install the microsoft loopback adapter (I am also running
the SQL Server and developing on my own laptop. Once I installed this
I was able to connect just fine to my SQL server.

Cody Olsen
 
P

pedroalves

Hummm, I think that your problem was because you had no tcp/ip stack
installed, because you had no network card, right? Installing the
loopback solves this. This is not my case, because I have an interface
card. Anyway I installed the loopback, just in case, but it didn't
solve my problem.... :(
Coud you give me the link to the article?

Thanks,
Pedro Alves
 
P

pedroalves

SOLVED!!!!

It was indeed the server! Doing a netstat -an revealed that the default
instance was not listenning on port 1433 even though that's what was
configured. Browsing on the event log, I noticed a message that stated
that because of a vulnerability, sql server disabled tcp access,
instructing me to update to the latest service pack. So I've done,
rebooted, and voila, I could telnet to port 1433 and the pda connected
too!!!
In the office setup, the server was already updated to sp3a, that's why
it worked there.

So in resume, one of the suggestions I make to everyone else running
into this problem,
try telnetting to port 1433, if it fails, then you have some firewall
blocking that port or sql server is not listenning there. do a netstat
-na on the server. There should be an entry like:
TCP 0.0.0.0:1433 0.0.0.0 LISTENNING
If not, then you must figure out how to enabled tcp access on
sqlserver.
Googling for sql server 1433 helps.
Now to hunt some bugs on the app :)

Thanks again,
Pedro Alves
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top