Solved

Sql Server 2005 Connection Error

Posted on 2007-11-26
3
165 Views
Last Modified: 2010-03-19
I am using the following connection string
"Data Source=(local);Initial Catalog=PAINT_DBS;Integrated Security=true"

Getting the Below Error. Not sure how to fix this.  I am using Sql Server 2005 Express.  My windows application would be installed on several machines which will have their own local database. So I am using the above connection string. GEtting the below error.

{"An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)"}
0
Comment
Question by:AdibRahman77
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 17

Expert Comment

by:Chris Mangus
ID: 20351412
Instead of coding your Data Source as (local) try servername\sqlexpress
0
 

Author Comment

by:AdibRahman77
ID: 20351535
I want this value to be dynamic. My application would be installed on several  machines.  I would not know the servername and sql server name in advance.
So I tried to use local to make it independent of the actual name. But this gives the above error.

0
 
LVL 17

Accepted Solution

by:
Chris Mangus earned 500 total points
ID: 20351616
You can retrieve the server name from the environment variable via VBA.ENVIRON$("COMPUTERNAME").  If you install SQL Express with all default options then the instance name is always SQLExpress.

Alternatively, you would need to use SQL Server Configuration Manager to set an alias to the local machine.
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question