Thursday, March 8, 2012

Connecting to an SQL Express Server via IP

Hi Everyone,
I am trying to connect to an SQL Express database via IP. The problem I am having is with the connection string itself. Currently I am using the below:

mysqlconn.ConnectionString = "Data Source=255.255.255.255,1433;Network Library=DBMSSOCN;Initial Catalog=images.mdf"

The problem is the program just freezes up. I double checked the port number and IP address and I know those are correct. I'm using Windows Authentication so I believe I don't need to put my UID and PWORD in there do I?

Can anyone help me with what I am missing

255.255.255.255 is not a valid IP address. To find out the IP address of your server, login to the server and run

ipconfig

and look at the value in the line called "IP Address".

|||I was just putting 255.255.255.255 in there because I didn't want to reveal my actual IP address. I am putting the correct IP in there, I'm just not actually connecting.
|||

Sure, makes sense.

Does the program freeze forever? Does it return any error?

What happens if you run

telnet <ipAddress> 1433

If you are connecting to a SQL Server database, the initial catalog is the name of the database you created earlier and want to use, generally without the ".mdf" suffix.

If you want to use Windows Authentication ("integrated security") you should specify explicitly:

"Integrated Security=true"

The default is false.

|||I think my problem is that I dont have the SQL server allowing remote connections :)

Whoops- sorry about that.

No comments:

Post a Comment