[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 430
  • Last Modified:

SqlConnection String for Sql Express 2005

I have created an application in c# .Net 2003 that accesses an Sql Server Express 2005 Database.

The application works fine on my PC (Where the SQL server resides) using the following connection string:-

                                                                "Integrated Security=SSPI;" +
                        "Persist Security Info=False;" +
                        "Database="+ database +";" +
                        "Server="+ server +";" +
                        "Packet Size=4096;" +
                        "Connection Timeout=" + timeOut.ToString() + ";";

However I can't connect on another PC to this server.

Which connection string do I have to use?
0
willbdman
Asked:
willbdman
  • 2
  • 2
  • 2
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
Do you get any errors ? You may have to enable remote connections for the server:  http://blogs.msdn.com/sqlexpress/archive/2005/05/05/415084.aspx
0
 
smeggheadCommented:
I'm assuming that you've already tried putting the name of the server into the connection string.

There was something I had to change on the server, which was to enable tcp/ip - as named pipes was the only protocol selected. I can't remember exactly where this setting is in sql-express - in sql2005 (full version) it's SqlServer configuration manager, and you'll probably see that tcp/id is disabled by default.

Hope this helps.
0
 
willbdmanAuthor Commented:
Tcp/ip is all enabled in sql configuration manager and surface area and connections.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Carl TawnSystems and Integration DeveloperCommented:
What exception are you getting ?
0
 
smeggheadCommented:
in what way does it not work then ? does it error ? what is the message ?

have you tried telneting to the port sql is listening on ? i.e. telnet 127.0.0.1 1433 (or whatever port you've set it up to listen on).. if it can't connect on that port, it isn't listening.
0
 
willbdmanAuthor Commented:
Thankyou carl_tawn!

There are so many little things that have to be correct for a connection to be done - in the end found that the Dynamic ports option in TCP/IP IPAll wasn't setup correctly.
For reference I have changed the connection string to:-

                                                                "Integrated Security=SSPI;" +
                        "Persist Security Info=False;" +
                        "Database="+ this.tbxName.Text + ";" +
                        "Server=" + ServerIP + "\\" + SQLInstance + "," + Port + ";" +
                        "Packet Size=4096;" +
                        "Network Library=DBMSSOCN;" +
                        "Connection Timeout=4;";

Thanks once again.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now