vb.net cannot connect to mssql server - sql-server

I am trying to connect to ms sql server but I get error: provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server.
This is in Windows form application. This application works correct and connects to MSSQL Server in other all other PCs but not in mine. This server is in local network. So I guess problem is not in MSSQL Server.
Before 2 months this application worked on my PC as well, as I coded it with visual studio 2008 and was debugging, all worked great. After that I have installed Visual studio 2012 and MSSQL express 2005 and 2008. So these changes have been made on my PC. Now I go back to edit my application and it cannot connect anymore.
I have searched the web and found that these servers 2005 and 2008 could be the problem. I have removed them both from my PC. Now I have Visual studio 2008 and Visual studio 2012. Could it be the problem for my connection to SQL server? There is no problem with connection to oracle or My SQL.
I cannot remove Visual Studio 2012 as I have code with it. Please help.

I don't think the problem is about Named Pipes or Visual Studio 2012, especially if other PCs in the network can connect to the server...
have you restarted your SQL server?
can you ping the server from your pc?
have you checked and rechecked the connection string?
can you create a connection to your database using Data Sources (ODBC)?
When you say "Now I go back to edit my application and it cannot connect anymore." do you mean in visual studio, debugging it OR you mean a deployed/installed version of your program?
If you're debugging, are you 100% sure you're trying to connect to the right SQL server and not localhost? I would definitely triple check the connection string and anything related to that
solution:
when in doubt, always write your IP address in connection string...

Mostly the problem will occur due to Firewall issue, did you try disable the firewall and test?

Google found me this. Please try to perform these instructions an let us know.
UPDATE
To enable named pipes and TCP/IP for Microsoft SQL Server 2005:
Click Start > Programs > Microsoft SQL Server 2005 > Configuration Tools > SQL Server Configuration Manager.
Under SQL Server 2005 Network Configuration > Protocols for MSSQLSERVER:
Double-click the protocol name TCP/IP and set the property ENABLED to Yes.
Double-click the protocol name Named Pipes and set the property ENABLED to Yes.
To restart MS SQL 2005 service, run the following commands in the command prompt window of the Parallels Pro Control Panel server:
net stop mssqlserver
net start mssqlserver

Can you Connect to another server from this PC?
If yes you can then maybe their something in your server prevent your PC from connecting.
if no then their is problem in your PC.
Also try connect using Server IP not instance name.

From all of the information you have provided I have a concern that this may be your SQL Server Browser service that is pointing you to one of the (now removed) servers that you had on the machine in question. Can you open the remote server from SQL Server Management Studio using the connection details in your web application from this computer?

Related

Advanced Installed SQL Server Failed to establish connection

I'm using Advanced Installer Architect 17.5 to create an .exe setup file. During my installation process, I need to run some SQL Server queries.
When it comes to creating a SQL connection, I could not find the right configuration to help me pass the connectivity test.
I've tried many different scenarios, I've used SQL Server or SQL Server Native Client 10.0 to connect to the database. I've also used Windows authentication mode (Trusted Connection/Impersonate user) or database logins, but all of them lead to an error
Failed to establish connection
in the test process.
Can somebody point out what is my error in this process?
I've brought screen shot for details. Please not I've also disabled Impersonate User and tried to login but all of them failed.
I've used many configurations for Server parameter such as . or .\ServerName or local.
I've also tried SQL Server 2008 and SQL Server 2017. Using the same parameters I can connect to server using SQL Server Management Studio.
I would try a couple of things first (If you haven't done them already):
Make sure your server is configured to allow remote connections. You can check this in SQL Management Studio, right-click on your server, click 'Properties' and go to the 'Connections' section.
Make sure the ODBC driver to connect to SQL Server is installed. You can get it from here -> https://learn.microsoft.com/en-us/sql/connect/odbc/download-odbc-driver-for-sql-server?view=sql-server-ver15

Unable to connect to SQL Server 2008 R2 from SQL Server Management studio or Toad for SQL Server

I have been Using SQL Server 2008 R2 database for quite sometime. All was working fine till two days back w.r.t connecting the database from SQL Server Management studio. Now if I try to connect, it keeps on connecting and it never shows me connected database in Object Explorer. Same thing happens when I try to connect using Toad for SQL Server.
Image showing connection details
However I am able to connect the same database (which is installed on my local machine) from my peer's SQL Server Management studio and he was able to access that database properly. Also I am able to connect the same database from my web application (which is also installed on my local machine) and also from Eclipse --> Database Development plugin.
I even reinstalled just the SQL Server Management Studio (I haven't uninstalled MSSQLSERVER during this) and tried again, yet it was showing the same result.
Also currently in the client protocols, Shared Memory, TCP/IP and Named Pipes are enabled.
Please let me know if anyone has come across this strange problem and really appreciate your help.

I can't connect to SQL Server 2014 Analysis Services

I'm trying to connect to Analysis Services in SQL Server 2014 on server (local), but appears this error:
Cannot connect to (local). Additional Information: A Connection cannot
be made. Ensure that the server is running.
(Microsoft.AnalysisServices.AdomdClient) A connection cannot be made
because the destination computer had refused.
Please help me solving this.
I am using Developer edition.
In my case, MS Analysis Services was not installed and that's why it was giving error. I ran the setup.exe to launch the installation wizard to add Analysis Services feature in my MS Sql Server and then it got resolved.
Since, I am using everything on one machine which is Windows Server 2012, I didn't require to make any change in firewall setting.

Unable to login to sql server

I dont know much about sql server.
I have just re-installed windows 7 on my laptop. After that I installed Visual Studio 2012 Express Edition. I also Installed SQL Server Management Studio 2008 R2.
Now when I try to log in to sql server management studio by using server name as . or (local) or .\SQLEXPRESS or PC-Name\SQLEXPRESS and using Windows Authentication I get the error as below.
Please dont mark this question as negative as I have searched on google for last 4 hours but did not understand the problem.
Update:
There are many reasons that may cautioning the problem:
SQL Server is not running
SQL Server is not properly configured
You try to connect with a worng instance Name
You can try the following:
Go to Mycomputer->Rigt Click->Manage->Application and Services
And from there check that SQL Server Express is running
2.From there also, gCheck the Instance name of your SQL Express and be sure when you log on to Management Studio you Provide the same Instance name
Confirm that the service is installed and running. Under Computer Management, drill-down into Services and Applications -> Services.
There should be a service named "SQL Server (SQLEXPRESS)". Try a restart or start of the service.
If any other instance of SQL Server is installed it will be listed - try connecting to LOCALHOST(whatever the instance is listed as) to verify the installation is functional.
UPDATED following further information from comments:
You may have only installed the client tools (management studio), and have not installed the database service. Ensure you have the correct installer which includes the database services engine.
First check that the SQL Server parameters are set accordingly.
Go to Start -
All Programs — Microsoft SQL Server 2008 R2 — Configuration tools —
SQL Server Configuration Manager
Under SQL Server Services, make sure that the instance is running :
SQL Server ()
SQL Server Browser
Under SQL Server Network Configuration - Protocols for (), these are enabled:
TCP/IP
Named Pipes
Do the same under SQL Native Client 10.0 under Client Protocols

SQL Server Connection Problems

I just upgraded to a Windows 7 box and installed MS SQL Server 2005 and am trying to open and connect to my local machine using Windows Authentication.
I keep getting 'Cannot connect to CHRISW7O980'. Do I have to start a server locally?
Suggest using this fantastic ServerFault answer to a similar question to help troubleshoot connectivity issues to new instances of SQL Server. There are a few configuration points to check.
Some likely culprits:
W7 firewall allowing SQL Server traffic on 1433.
SQL Server services running?
SQL Server Configuration Manager not allowing TCP connections.
SQL Server Can't Connect
Check in Sql Server Configuration Manager to ensure your instance of SQL Server is running. If not, you can start it and set the Start Mode to Automatic to automatically start it when windows reboots.
Maybe you are running SQLExpress? Try this for the instance name:
Try using .\SQLEXPRESS.
When you installed SQL Server on your local machine, did you install SQL EXPRESS? If so, you may have to use the instance name CHRISW7O980\SQLEXPRESS.
Also, remember that connections over TCP/IP are disabled for newly installed SQL servers. You'll have to enable that in the SQL server manager.

Resources