Connect ot SQL Server Express 2012 over the internet - sql

I've been trying to configure my sql server express 2012 to recieve connections over the internet without any luck for hours (I'm using Team Foundation Service for nightly builds but it fails when it tries to run unit tests that interact with the sql server).
All I keep getting is this message :
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)
I have tried the following in order to solve this:
Install and run SQL Server Browser
Enable TCP/IP for the sql server instance (using the default SQLEXPRESS)
Enable Port forwarding in my router
Added SQL Server and SQL Server browser apps to the firewall allowed apps list.
Banged my head against the wall.
My sql server is mixed mode, and the username and password are correct (it works when using the local ip address)
I've read every post here regarding this problem but nothing so far..
I'm pretty desperate so any advice will be greatly appreciated!
thanks

Solved it.
Only had to enter my public IP adress without the isntance name.
For example xxx.xxx.xxx.xxx instead of xxx.xxx.xxx.xxx\SQLEXPRESS
I can't believe it's such a stupid mistake ...

Related

Can't connect to a SQL server remotely

i'm a new to stackoverflow but maybe i may also ask a question. I also hope i can help others to find solutions regarding their issues.
So, here we go. I moved a database from an old SQL server to a new one. While trying to configure the application to use the new location of that database shows up an error message like this:
Cannot connect to \MSSQLSERVER.
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: 25 - Connection string is not valid) (Microsoft SQL Server, Error: 87)
The parameter is incorrect
So i started an analysis to solve this issue. And i checked those things:
DNS resolution -> check
ping to the new SQL Server -> check
Firewall disabled -> check
Remote connections on SQL Server enabled -> check
Still receiving this error message. I configured the SSMS on the application server and ran that as SQL server service user without any success.
SQL Server browser is running
TCP/IP is enabled using the default port 1433
I am not sure regarding the SQL server instance name. IMHO it is shown in the service name and the default instance name is MSSQLSERVER. The error message mentions that the connection string is not valid.
So, at this point i don't have any further ideas.
Greetings,
Chris
[EDIT] I don't use any specific connection string because i connect using SSMS.
enter image description here
[EDIT2]
I was able to connect locally using the hostname (not localhost).
All tests below do not use an instance name
Test Result
-----------------------------------------------------
Locally, hostname, AD Auth Success
Remote, hostname, AD Auth The target principal name is incorrect. Cannot generate SSPI context
Remote, FQDN, SQL Auth Connection string is not valid
Step 1: Login Authentication Windows or SQL Server
Check your login Authentication whether its Windows or SQL Server.
Step 2: Use (.) (dot) instead of complete server name
If you are using local MS sql database then you can use (.) (dot) instead of complete server name.
Step 3: Enter Correct Host Name
Enter your correct host name: (hostname\SQLEXPRESS) my_hostname\SQLEXPRESS (in case of SQL Server Express) or (my_hostname\mssqlserver).
Step 4: Try localhost slash () then host name
You can also try localhost slash () then host name, here is sample as (localhost\SQLEXPRESS) or (localhost\mssqlserver).

Troubleshoot Connecting to the SQL Server Database Engine

I'm trying to connect to SQL Server from my .NET application.
I tried it on my pc and one other pc with already installed sql server.
I needed to test my app and I started virtual machines (windows 7 and 8.1).
I am constantly getting 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: Named
Pipes Provider, error: 40 - Could not open a connection to SQL
Server)"
I tried everything that i found on internet that might help.
Nothing works for me.
Im using VirtualBox for virtual machines.
Is there might problem with that or even problem is because I'm trying to do it on VM. How can I resolve this?
Check this is this helps go to run -> sql server configuration manager then check sql server service are running and then client protocol enabled

Cannot login to sql server 2008 R2 after rebooting server

I am using Windows-server-2008 with Microsoft SQL Server 2008.
And there are a lot of questions about this, but nothing on the internet solved it.
The problem is that i can't connect to the my SQL Server 2008 R2 after rebooting my server.
I placed some new memory in my server, and after rebooting my client/server application didn't work anymore because it cannot reach the database.
So i tried to get in SQL Server Management Studio (SSMS), and tried to loggin with Administrator and another user but both do not work.
When i logg in the following message is displayed:
Cannot connect to (local)
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: 2)
I Tried a lot of different things like:
Rebooting server
Try to start the server manually from Sql Server Configuration Manager
Named Pipes - Enabled
TCP/IP - Enabled
Tried to create an new system user or database user as described in the following article: Click Here
Can somebody please help me? I am really confused because i need to get this online. Otherwise i have to reinstall the database server but i do not have a back-up. (is there some folder with a back-up of the settings/tables/columns are stored and can be imported from reinstall?
I was having the exact same problem. net start mssqlserver was giving me the blurb about a failed login attempt. The problem was that I had recently changed the password for the administrator account, and the new password didn't get updated in services.
Here's how I fixed it:
First locate SQL Server from the list here:
Right click and select properties, and navigate to the Log On tab:
Then I typed the new password, and like magic I was able to start SQL Server right through the services manager.
I also did this for any other processes which were marked as "stopped" even though Startup Type was marked as "automatic" (namely, SQL Server Agent).
Is it a named instance or default? Also, is this a local instance? (I see the "(local)" but just wanted to make sure.)
Start the sql server services from services.msc and try to connect

Cannot connect to SQL server - client side issue

I might be the million'th person posting about this, but others' solutions haven't helped me. I have a database on Microsoft SQL Azure. I an trying to connect to it using the Visual Studio 2010's "Connect to Database" Tool.
From my Windows 7 machine, I can connect to it very easily. But from my Windows Server 2008R2 machine i am getting the classic 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: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
All the posts around the web seem to be focussing on the problems on the server side, no one cares if the client goes rogue. :(
Thanks for the replies.
I have seen similar problems with VS2010 DB Tool and Windows Server so I would not suggest try using SSMS 2008 R2 (must be R2). Once you have download SSMS 2008 R2 and configured properly to work on Windows Server it sure will work. In most of the case you really need to open SSMS settings to get it workon on Windows Server.
Next a few points to check:
Verify that the telnet is working from your Windows Server Machine:
c:>telnet _your_sqlazure_database_name.database.windows.net 1433
Disable your real time security and the try again
Finally following the link to keep applying settings in your Windows Server and SSMS which are applicable and I am sure it will work:
http://www.mssqltips.com/sqlservertip/2340/resolving-could-not-open-a-connection-to-sql-server-errors/
One issue is that you need to connect via tcp, not named pipes (per your error message).
Are both servers behind the same firewall (e.g. the same external IP address)? The SQL Azure firewall needs to be configured to allow access from remote IP addresses.

sql server connection error

I keep getting the following error when I try to register a db server:
TITLE: Connect to Server
Cannot connect to p3swhsql-v14.shr.phx3.secureserver.net.
ADDITIONAL INFORMATION:
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) (Microsoft SQL Server, Error: 3)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3&LinkId=20476
BUTTONS:
OK
I googled, but most of the solutions are related to checking stuff on the sql server. It
s a shared server and I don't have access to the machine. I tried to register another db server and I get the same error. I know the connection properties are correct. I am not sure what else I can do. Btw, the windows firewall on my local machine is disabled.
There is a similar thread with some suggestions at: Getting a sql connection error when trying to login.
Other possible issues could be a firewall on the server side that is only allowing connections from a certain IP range. Even if your own firewall is off, that doesn't mean the server's firewall is letting your machine through. Did the server admin open up a hole for your home machine?
If the server isn't set up to receive remote connections and you can't edit the server, I'm not sure that there's much you can do. You can't connect to a remote database if it doesn't want you to, and for good reason.
Many times, you can also be limited to just one IP or range of IPs, so it won't work from multiple locations. Again, this is something to set on the server, so you'd need to check with your provider.
This error was due to the office firewall. If I connect to another VPN, everything works fine. Whilst doing research on google, I came across something perhaps it could be useful to somebody else.Go to the registry editor:
HKEY_Local_Machine > software > Microsoft > MSSQLServer > Client > SuperSocketNetLib . The protocolOrder in my instance was set to start with np tcp and so on. You can modify the order so that tcp :: port 1433 is used before trying to connect via named pipes.'
Check out this link.
It was very helpfull. Just follow few steps and u will get to know the solution
http://techpint.com/programming/error-26-%E2%80%93-error-locating-serverinstance-specified-sql-server