Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Local SQL Connection

Status
Not open for further replies.

allanmc10

Programmer
Feb 23, 2006
39
GB
i am writing an app that needs a local connection but keeps getting this 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)

my connection string is ("Data Source=(local);Database=QMicro" & "Integrated Security=SSPI;")

i do not have SQL server 2005 on my computer yet i still get the above error.

What is even more funny is that i have this app and connection string on my home PC and works fine.

regards

big al everybodies pal
 
(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)

that is the error i get when trying to connect to SQL Server(local).

At my work i have SQL Server on a server but i have installed SQL SERVER personal addition so i can write an app for a local machine using a local connection to SQL SERVER 2000
 
First you say

do not have SQL server 2005 on my computer yet i still get the above error

And now you say you have it installed. DID you set the permissions for the sql-server? Can you get a connection to it via query analyser/enterprise manager?

Christiaan Baes
Belgium

"My new site" - Me
 
Try this connection string:

"server=<LOCAL_MACHINE_NAME>;Trusted_Connection=yes;Initial Catalog=QMicro;"

Use your local machine's name in the place of <LOCAL_MACHINE_NAME>

I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
firtsly i do not have SQL server 2005 on my PC everything is done through 2000.


What it is at my work SQL Server is installed on a server and we have just the client tools on local PC but i installed a Personal addition of SQLServer 2000 on my PC so i can have Server and Client on my PC for a local connection.

Yes i can see the local connection through query analyser/enterprise manager and can also create queries through query analyser. My program is just not connecting localy
 
Or try this connection string:

"server=127.0.0.1;Trusted_Connection=yes;Initial Catalog=QMicro;"


Christiaan Baes
Belgium

"My new site" - Me
 

still the same, have tried the 2 connections. do you think it could be the way SQLServer is installed for the local connection, because if i revert to connecting to the database through the works server then it is ok(i have a back up database on works server).

The error i get i feel it keeps looking for the remote server(works server) and not the local connection on my PC yet i am telling to to go for local connetion.

thanks for the help
 
For server, try using <LOCAL_MACHINE_NAME>\<SQLSERVER_INSTANCE_NAME>

if you provided an instance name for the SQL Server when you set it up. I believe that in order to connect to a SQL Server using just the machine name, you have to leave the instance name blank when setting up SQL Server.



I used to rock and roll every night and party every day. Then it was every other day. Now I'm lucky if I can find 30 minutes a week in which to get funky. - Homer Simpson

Arrrr, mateys! Ye needs ta be preparin' yerselves fer Talk Like a Pirate Day! Ye has a choice: talk like a pira
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top