SQL Server connection string to a remote server - sql-server-2008

I have a remote SQL Server Express (2008 R2) with an IP: xx.xxx.xxx.xx and an instance name: myInstance.
I have been trying to connect to a DB (myDB) as user (dbUser) and with password (myPass).
I have tried various string combinations but none works. I am sure I got it wrong because the server is ok, I can ping the IP Address, SQL Server runs on port 1433, which is open. I have also enabled browser service and remote connection on the server.
Please someone give me the correct string...

How to: Configure Express to accept remote connections

There could be many reasons for this, however, you didn't post any useful details such as error messages or what exception was thrown (if any).
Check that Windows Firewall allows access on port 1433 - this is the most likely reason for the failure, since you are using an IP address and not the name of the instance.
I suggest looking at http://connectionstrings.com to check your connection string.

Related

SSH tunnel to MySQL database

We're in the process of setting up Tableau connectivity to our company's sales database and so far, the people that have been attempting to connect (they're from some other company) keep getting denied. The errors they're getting are as follows.
Unable to connect to the ODBC Data Source. Check that the necessary drivers are installed and that the connection properties are valid.
Can't connect to MySQL server on '[IP address] (61).'
Unable to connect to the server '[IP address].' Check that the server is running and that you have access privileges to the requested database.
Today we opened ports 3306 and 20560. We were hoping we could set up some kind of port forwarding thing so that they connect to 20560. I'm not sure what we need to do to set that up, however. I was also told that SSH tunneling is an option, but connecting with PuTTY doesn't yield any results.
I'm at a complete loss as to what I need to do to allow them to connect. I'm also not sure that opening port 3306 is safe and I'd like to know if I should have it closed. I randomly picked port 20560 because it's not being used for anything. We don't want just anyone to connect, but I've been told that the IP address connecting to our database may not be static.

[hy000][mysql][odbc 3.51 driver]Cant connect to MYSQL server on 'mysql8.namesco.net' (10061)

I'm having a right nightmare trying to link Microsoft Access to MySQL.
I have selected the ODBC 3.51 to connect to mysql on access
Details required:
TCP / IP - mysql8.namesco.net OR IP Address
Named Pipe - BLANK
Username - **
Password - **
Port - 3306 (Default)
Database name
After I enter the above details i'm prompted with the following error:
Connection failed:[hy000][mysql][odbc 3.51 driver]Cant connect to MYSQL server on 'mysql8.names.net' (10061)/
I get the same error when I use ODBC 5.1 Driver:
Connection failed:[hy000][mysql][odbc 5.1 driver]Cant connect to MYSQL server on 'mysql8.names.net' (10061)
I have no idea what i'm doing wrong!
any help to resolve this would be amazing!
Can you ping the MySQL server from your machine? Can you connect to MySQL from your machine with any other MySQL client?
Sometimes hosting companies like names.co.uk put their MySQL servers behind firewalls. You may need to consult their tech support if you need access from someplace outside their data center.
Max Thorley: How do i ping? is it telnet IP address? I contacts names
to allow remote access. I gave them my public facing IP and IPv4
(which i believe is static)?? This what I get with telnet
C:\Users\max.thorley>telnet 192.168.35.24 Connecting To
192.168.35.24...Could not open connection to the host, on port 23: Connect failed C:\Users\max.thorley>telnet mysql9.namesco.net
Connecting To mysql9.namesco.net...Could not open connection to the
host, on por t 23: Connect failed
Try telnet mysql9.namesco.net 3306 to see if you can access the MySQL port. You probably can't. If you can't get to it you'll get a similar message to the ones you got with other telnet attempts. That means your hosting service has firewalled the MySQL server. If you can get to it you'll get some gibberish that looks roughly like this:
5.5.5-MySQL
%\~)L%q? $p*}X!73:i%wmysql_native_password
You probably can't get to it. This is common hosting-service practice, because it's a shared server and it's not very hard to mount denial-of-service attacks against MySQL servers. Again, you need to consult your tech support.
if its a hosting server you need to log into your cpanel and add your
external ip in the allowed ip range to connect the databases. also
many hosting have standalone ip for accessing database. as below
answer says raise ticket to your hosting support and ask for help –
krish KM

Login failed for user 'sa'

I am trying to connect to a sql server in my asp.net application. I have given connection string in my web.config as follows :
I am getting following error while running the application :
"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)"
If i use remote server's ip address as data source in connection string, I get following error
"Login falied for user 'sa'"
I researched and found some ports need to be opened between the server and my machine, which I got done by network team, still the same issue. How to resolve this ?
You can not directly. you need to have TCP/IP enabled and configured the TCP/IP Ports on sql server configuration manager at remote server.
you need to have TCP/IP connectivity .Just launch it, enter the DNS host name or IP address in the Server Name' box and hit Connect. The hosting company needs to have enabling TCP/IP on your SQL Server instance, and them providing you with secure access to the IP address that instance is running on.
Most administrators do not allow direct access to the SQL Server from outside the firewall. In that case, if you can connect to the host over VPN then you should be able to connect directly to the server with Enterprise Manager or SQL Management Studio.
Please go through it Configurations-Remote-Server
Are you porting code from Hypersonic or H2? If so, the username sa won't work.

Connection String for Remote Connections to SQL Server 2008

I am trying to connect remotely to SQL Server 2008 R2 Express on a server running Windows Server 2008 R2. I receive 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: TCP
Provider, error: 0 - A connection attempt failed because the connected
party did not properly respond after a period of time, or established
connection failed because connected host has failed to respond.)
I think the problem might be related to my connection string, because I am not sure exactly what it should be. I understand the connection string should take the form:
Data Source=123.123.123.123\InstanceName;Initial Catalog=MyDBName;user id=MyUserName;password=MyPassword;
The instance name of my SQL Server installation takes the form ComputerName\SQLEXPRESS. This is what I see when I log in to Management Studio on the server. So should the connection string begin with
Data Source=123.123.123.123\ComputerName\SQLEXPRESS
This looks wrong because of all the slashes. I have tried to omit the computer name thus:
Data Source=123.123.123.123\SQLEXPRESS
I also read somewhere that you can specify a port so I have also tried
Data Source=123.123.123.123,1433\SQLEXPRESS
because I understand that 1433 is the TCP port used by SQL Server and
Data Source=123.123.123.123,1434\SQLEXPRESS
because I understand that 1434 is the UDP port used by SQL Server browser.
I have also tried every combination of these and they all give the same error.
These are the steps I have taken to enable remote browsing on the server:
In Management Studio, right click the instance, go to Properties, Security and check SQL Server and Windows Authentication Mode. On the connections tab I have checked "Allow remote connections to this computer".
In SQL Server Configuration Manager I have enabled all four connection options (Shared Memory, Named Pipes, TCPIP and Via) under every node they occur. Under protocols for SQL Express I have tried specifying port 1433 and also leaving it blank with TCP Dynamic Ports set to 0 (which I think is meant to enable dynamic ports).
I have created firewall exceptions for TCP Port 1433, UDP Port 1434, and program exceptions for sqlservr.exe and sqlbrowser.exe.
If someone could tell me which of the four versions of the DataSource part of the connection string I should be using it would be a great help, even if it did not solve the problem. It would mean that everything I try subsequently I would only have to test once instead of four times.
Thanks in advance for any help!
Where did you enter the firewall exceptions, on your machine, on the server, or both?
The second connection string is the only really valid one. Can you telnet to the server on port 1433? Can you connect to the instance from Management Studio remotely and the problem is only from your code where the connection string is? Did you try running the same code on the server? Did you try forcing TCP/IP (vs. named pipes/shared memory etc) adding the following parameter to your connection string:
Network=DBMSSOCN;
This question comes up quite a lot and I'm sure you're hitting something that others have hit before. Have you gone through this article, "How to troubleshoot connecting to the SQL Server Database Engine"? Also there are 20+ questions on here that mention this error message and Express, according to this search result. I suggest double-checking your settings against some of the items in those answers that solved the issue for other users.

SQL Server Express - Remote Connection continues to fail

I have been unable to configure my SQL Server 2008 Express to allow remote connections. I followed the instructions from this guide: http://www.linglom.com/2009/03/28/enable-remote-connection-on-sql-server-2008-express/ .
I am still getting the following error:
Cannot connect to 00.00.00.000
Additional information:
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: 3)
I also configured the firewall as defined in http://blog.sqlauthority.com/2009/05/21/sql-server-fix-error-provider-named-pipes-provider-error-40-could-not-open-a-connection-to-sql-server-microsoft-sql-server-error/ . As a test I even turned off the firewall, but nothing changed, so it is not the issue.
Update under server name, it only says the IP address. Do I need something more?
In the Server name field of Connect to Server, I had myipaddress. I changed it to myipaddress\SQLEXPRESS and it works.
In addition, once this was working without the firewall I applied settings as defined in http://www.sevenforums.com/system-security/58817-remote-access-sql-server-express-2008-windows-7-a.html to make the connection work with the firewall turned on.
Do you have sysadmin rights in sql express? It may be that your user account doesn't have the necessary permissions. There is a script on codeplex that will add you logged on account as a sysadmin.