Unable to connect to SQL server while testing - visual-studio

I am working with Microsoft Visual studio Test, I do not know how to deal with the following error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 – Error Locating Server/Instance Specified)

Make sure your database engine is configured to accept remote connections
Start > All Programs > SQL Server 2005 > Configuration Tools > SQL Server Surface Area Configuration
Click on Surface Area Configuration for Services and Connections
Select the instance that is having a problem > Database Engine > Remote Connections
Enable local and remote connections
Restart instance
Check the SQL Server service account
If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this first before proceeding
If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application
Usually the format needed to specify the database server is machinename\instancename
Check your connection string as well
4.You may need to create an exception on the firewall for the SQL Server instance and port you are using
- Start > Run > Firewall.cpl
- Click on exceptions tab
- Add the sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Binn), and port (default is 1433)
- Check your connection string as well
If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings
Check SQLBrowser; check that it is running. You may also need to create an exception in your firewall for SQLBrowser.
Check that you have connectivity to the SQL Server. Note what you are using to connect: machine name, domain name or IP address? Use this when checking connectivity. For example if you are using myserver
Start > Run > cmd
netstat -ano| findstr 1433
telnet myserver 1433
ping -a myserver
Check what ports are IP addresses are being returned.
Alternative:
If you still can’t get any connection, you may want to create a SQL account on the server, a corresponding SQL user on the database in question, and just use this username/password combo in your web application.
Credits for this answer goes to belle of sqlmusings.com

Related

Error occurred while establishing Database connection in Visual Studio

Anyone have an idea how to solve this problem?
A network-related or instance-specific error occured while establishing a connection to SQL Server. The server was not found or was not accessible.
Verify taht the instance name is correct and that SQL Server is configured to allow remote connection. (provider: SQL Network Interfaces, error: 26 - Error locating Server/Instance specified)
Thanks in advance!
Make sure the instance of the server is started. Do this from Start Menu-> Microsoft SQL Server... ->Configuration Tools->SQL Server Configuration Manager->SQL Server Services
If it is not on your local machine, i.e. on a remote server, then your account needs a login on the SQL Server that is granted access to the DB you are trying to connect to.
Usually the local server instance by default is installed with access for yourself. But it doesn't hurt to check.
Also if it is remote, can others connect successfully? If not, then you may also need remote connections enabled on SQL Server.
Making sure you have the name of the instance correct is important. Slashes should be back slashes, not forward slashes. What are you using for the instance name?

Cannot connect to Oracle server

I have a Oracle server which can be accessed locally (i.e. from the computer where Oracle installed) using SQLPlus and default port 1521.
From a client computer, I can access shared folders on that server, but I cannot access the oracle database using SQLPlus or SQL Developer. "IO Error: The network Adapter could not establish the connection."
I am sure that there are problems on the Oracle server, because I can access other similar Oracle servers from the same client.
There is no problem with network connection as well.
Tnsnames.ora files are also OK. Three oracle services are started (same as other similar Oracle servers): listener, DBConsole and Service.
All are Windows systems.
How can I figure it out?
P.S.:
No firewall on server;
tnsping is OK.
I think the listener on the server or tnsnames.ora on client is the problem. When connecting from the server the sql*net protocol is bypassed.
On server run :
c:\lsnrctl status
and check if database is serviced by the listener and check if parameters are the same as in tnsnames.ora, use fully qualified host names.
EDIT
Check
c:\lsnrctl services
May be your firewall block your port. you can enable this by changing firewall setting.
This is windows 7 configuration to access port
Control panel->system and security->windows firewall->advanced setting->In bound rules-> new Rule(On right hand side)-> select port option with value as "1521" -> next next....

Unable to start SQL server Agents

been trying to configure an ADO.NET connection for my Visual Studio application but I am running into issues and having no luck at all troubleshooting them. The major error that I run into is:
A network-related or instance-specific error occurred while establishing a connection to SQL server. The server was not found or not accessible. Verify the instance name is correct and that SQL server is configured to allow remote connections (Error 40: Could not open connection to the SQL server)
The steps I undertook to troubleshoot this are:
1. Open up Sql server configuration manager and under the SQL Server Network Configuration, Protocols for MSSQLSERVER,SQLExpress, SQL server 2008 connection string data source I enable each of the protocol names (Shared memory, Named pipes,TCP/IP,VIA)
As instructed I stop the SQL server services first under the SQL server services nodes.
Now I click start, MSSQL server service starts but both SQL Server 2008 and SQLEXPRESS agents do not. Stating the following:
The request failed or the service did not respond in a timely fashion. Consult the event log or other applicable error logs for details
This might just be the problem as when I attempt to create the connection string , the server name specified is MYWORLD/SQL SERVER 2008. Since the SQL server 2008 agent service refuses to start, the connection fails, leading to the first error message.
Does anybody have any leads on this and can let me know the necessary steps to mitigate this.
The SQL Browser service must be running to connect to a named instance.
Use SQL Servr Configuration Manager under Configuration Tools under Microsot SQL Server 2008 to assign the logon accounts for each service you want to run. Do NOT use any other method to assign user accounts because the correct rights will not be enabled.

Connecting to database on web host in Visual Studio or Sql Server Management Studio

I have a web site developed locally with a local Sql Server database. I also have a web host that provides one Sql Server database for my site. Now I want to deploy the application, and I would like to be able to manage the remote database from the Server Explorer in Visual Studio. I have the connection string used in the application, which works fine for adding, say, a datasource to a control etc. But I don't know if there's any way to use it to connect the database inside the Server Explorer so that I can add tables etc. I have read that you're supposed to be able to this instead of using the Sql Server Management Studio, but I have'nt read anything about how to connect to the remote database in it.
What I have tried so far is this: I have selected Add database in Server Explorer. This brings up first a dialog where I choose Sql Server. And then I get a dialog where I can set Server name (which I tried using the ip address in the connection string below), and Authentication (where I chose Sql Server Authentication, with the user id and password from below). But when I test the connection it fails.
Here's the connection string, which works fine when used for datasources in the application (obviously with different user name and password):
Any help appreciated!
EDIT:
Well, I've done everything suggested by lewiguez below now, but it doesn't make any difference. I can't believe this should be so hard... I keep getting this error message in Sql Server Management Studio:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)
Here's the process I follow for working with remote databases:
In VS 2008 under the Server
Explorer tab, right-click on "Data
Connections" and then click "Add
Connection"
Change the Data Source to
"Microsoft Sql Server"
Put in your fully-qualified
"Server Name" (be it IP Address, domain name, etc.), select "Sql Server
Authentication" and put in "User
Name" and "Password" for the database user
Select the database you want to connect to under "Select or enter a database name"
Hit "Test Connection" to test and then "OK" to accept
You should be able to interact with the database at this point by expanding the connection and then the "Tables" folder. For example, right-click on the Tables folder and you'll be presented with an "Add Table" option in the dialog. Right-clicking an existing table will bring up the "Open Table Definition" options where you can change any columns, etc.
If you're not getting to this point (and it sounds like you're not), I'd recommend checking your Sql Server connection from whatever machine you're using.
I generally do this by going into the Management Studio and connect with whatever credentials I'm trying to use. If they don't work, make sure they are, in fact, added as a Sql Server user and a database user (they have to be both).
Also, I would check in the Sql Server Surface Area Configuration Manager. You have to allow TCP connections and you have to be set up to allow Sql Server Authentication connections as well from remote hosts. If THAT'S all set up, but you still can't connect, I'd double-check to make sure your firewall is allowing Sql Server connections. The default port is 1433.
Also, if you can connect, but then can't write to anything, double-check your table permissions. Hope this helps!
I finally understood the problem: as I suspected the settings in my own installation was not the problem, but rather it was the settings on the Sql Server installation on my web host. And in fact I found a place in the control panel on my web host where I could set an exception to my ip address so that my ip would be granted access to the port 1433 for Sql Server, which is otherwise closed by default for security reasons.
I've had no luck finding any information about this at all on the internet, which I find strange. All the information I could find had to do with changing these settings on your own local installation of Sql Server. But I'm sure there are loads of people out there who like me use a web host for deploying their web site, and then that info doesn't seem to apply. (Perhaps apart from the TCP setting, which I think must be set, and there's detailed info about that here: http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/ )
Hope this helps someone else who like me uses a web host. Now everything works fine for me at least, both in Management Studio and in Visual Studio Server Explorer.

Linq failing to connect... or is it?

I have a web-application which is reciving the following while trying to connect to a database hosted on another server.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Now, there problem here is that the connection strings, and the server paths area all perfect.
The site run correctly when run via cassini, on my local machine. (Connections strings are correct.)
Other sites hosted on the same server are able to access the databse. (Server paths ara all active.)
While the error says it's been unable to connect, Activity Monitor is aware of the query, and the Server Logs show no error. (Just odd.)
Google & Bing have massively failed with this, so I guess it's time to hit the Stack!
Open the Sql Server Conifguration Manager, expand Sql Server 2005 Network Configuration, click Protocols for <Yourserverinstance>, then check TCP/IP is enabled.

Resources