How to connect to Microsoft SQL Server via forwarded ports? - sql-server

I've forwarded the ports, which SQL Server is using, from my local machine to the machine where SQL Server is running
netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=1433 connectaddress=192.168.1.110 connectport=1433
netsh interface portproxy add v4tov4 listenaddress=127.0.0.1 listenport=1434 connectaddress=192.168.1.110 connectport=1434
Then I am using Microsoft SQL Server Management Studio to connect to the Database with the IP Adress 192.168.1.110, which is working fine.
Trying to connect to localhost, or localhost,1433 (mind the comma, instead the colon), does not work.

Use 127.0.0.1 instead of localhost.

Related

Why can I not connect to SQL Server using server name, but works with IP Address?

So, I have two PC (PC-A and PC-B) that I've set up with Windows 7 and SQL Server 2012. I setup a port forwarding for PC-A so I can access it remotely.
I can connect to SQL Server on PC-A from PC-B (using SQL Server Management Studio) by entering the PC-A ip address, but unable to connect if I'm using the server name of SQL Server on the PC-A.
Any ideas to make it works?
Try using tcp:[Server Name],1433
1433 is the default port numberused by sql server
Found a workaround to this problem. I install hamachi on both PCs, register them to a same hamachi network. And now I can connect using the server name.
Thanks all for the suggestions.

Can't connect to SQL Server on Server 2008 R2 VM; port 1433 is open

I have a virtual machine running Windows Server 2008 R2 and SQL Server 2008 R2. The host is running Windows 7. I can connect to the SQL server from the VM using SQL Server authentication, but I can't connect from the host using the same method and credentials. I can ping the VM from the host, but I can't telnet to port 1433. On the VM, port 1433 is open through the firewall, TCP/IP is enabled on the SQL instance, and all IP addresses in TCP/IP properties are enabled. I have verified that SQL Server is listening on port 1433. I've been trying to figure this out for two days and I'm about at wit's end. Any ideas?
The problem turned out to be the IP address I was trying to connect on. The VM would respond to pings, but nothing else was listening there, I take it. Changing the IP address for the VM in my hosts file to the first one listed under the VM's ipconfig fixed it. (I'd taken the IP address I was trying to use from SQL Server Configuration Manager, which got it from ???.) Our network guy figured it out for me, so I can't give more details, sorry.
Try this:
Goto SQL Server Configuration Manager from start menu then from the left pane choose SQL Server Network Configuration then choose your instance name..
Then from the right pane choose TCP/IP .. make sure it's enabled then :
In its properties > IP Addresses clear any field named TCP Dynamic Ports and for any field named TCP Port set its value to 1433

How to connect to SQL Server in Win7 virtual machine from Mac host?

I restored a MSSQL backup to SQL Server Express in a Windows 7 virtual machine under Virtualbox. I am attempting to connect to this SQL Server instance from the host (Mac OS) using a user inside the imported database that has credentials to connect. The virtual machine is configured to use a Host-Only adapter. SQL Server express is running inside the VM at WIN7VM/SQLEXPRESS, port 1433.
I am able to connect to Apache in the VM on port 8080 from the Mac host without a problem. I can also telnet into the SQL server at port 1433 from the Mac host, using the host-only IP address (192.168.56.101).
What I am unable to do is connect to SQL server from Navicat in MacOS, or remotely using PHP. Here is what I have tried:
Disabled Windows Firewall
Configured SQL server port setting to use 1433
Enabled SQL server authentication
Enabled TCP/IP in SQL Server
Enabled remote connections to SQL server
I am trying to connect with this info:
Host/IP address: 192.168.56.101 OR 192.168.56.101\SQLEXPRESS (have tried both)
Port: 1433
Database: MyDatabase
Authentication type: Basic
Username: username
Password: password
What am I missing here to be able to remotely connect without any issues? Thanks in advance!
I believe you need to use a Bridged Adapter - rather than a Host-Only adapter. A Host-Only adapter does not use the physical NIC - so that is probably the issue here. I have encountered the same issue before.
Using a Bridged Network connection on both the Host and the Guest - will mean that both are on the same network. Assuming the firewall are not blocking port 1433, you should be able to connect without issue.
It turned out to not be a Virtualbox issue, but a SQL Server authentication issue.
The user I was trying to connect with had access to a database, but did not have a corresponding SQL Server Login.
MSDN - Managing Logins, Users, and Schemas How-to Topics

Access MySQL server on Windows from Vagrant

I've been trying to connect to my database with no success. From XAMPP or HeidiSQL I can connect to my database (Oracle MySQL Server 5.5) using IP 127.0.0.1 or just localhost, but I can't figure out how can I connect to this DB from Vagrant. Any suggestions?
So with some help I managed to connect. All I had to do, was to connect to Vagrant IP ending on 1 (my vagrant IP is 172.17.2.3 so I had to connect to 172.17.2.1) and also had to create another DB user without IP restriction.

Cannot connect to MSSQL 2008 with ip 127.0.0.1

I dont have much experience with MsSql. I have no problem to connect to database by SQL management studio with SQL Server Authentication Mode on ip 127.0.0.1.
But my program fails to connect. I created file connect.UDL for test connection and got this error
[DBNETLIB][ConnetionOpen (Invalid Instance()).] Invalid connection
Some information may usefull
SQL server is on configured as Mixed Authentication Mode
DIsabled my firewall
Enabled all protocols (Shared Memory, Pipe names, TCP/IP, VIA)
Using 127.0.0.1 and 1433 port for TCP/IP protocol
Allowing remote connection on server
Can provide more information if you need. Thanks
EDIT : I deleted everything and installed SQL SERVER 2008 R2. Everything working now. Thanks all for your effort.
Ensure you have installed SQL Server as a "Default instance" in order to be able to connect with just the IP address or hostname. If it's a "Named instance" installation, you will need to specify the hostname and instance name to connect. (i.e. MY_HOST\MY_INSTANCE)
Check out the SQL Server Configuration Manager, and under SQL Server 2008 Services section, does the installation have the "Names instance" in brackets? - That's your named instance.

Resources