Why I cannot connect to Linux MSSQL (SQLEXPRESS) from my Windows computer? - sql-server

I just installed MSSQL on debian 8 (64bit) fallowing this steps on this link. It installs ok, no errors, I can also use sqsh -S localhost -U sa and it connects and I can execute SQL commands normaly. I choose to install SQLExpress license, so I suppose that instance name is "\SQLEXPRESS"
I install MSSQL server on my "mini computer" that is connected to my router (which sets DHCP). With other devices connected to this router I can ping this "mini computer" and also in other side, from "mini computer" I can ping other devices. All devices are in Workgroup, and not in Domain. Also I can connect with SSL to this "mini computer".
But If I want to connect from my Windows computer from Microsoft SQL Server Management Studio, I get error, that I cannot connect to this "mini computer": The parameter is incorrect! What I am doing wrong, is it possible to make connection like this, or I have to have domain server?

when you get a message :
the connection is established, but an existing connection was forcibly closed by the remote server
that means the connection is correct but this error could happen sometime for windows version, try it with other windows version and other SSMS version.

Related

SSMS - Microsoft SQL Server Management Studio 18 do not discover SQL Express network servers

I've 4 SQL Express servers on my network, and I'm able to connect to all of them with SSMS from the different computers across the network.
But I'm not able to see them in the SSMS "Browse for Servers" window if i'm doing a search (Browse for network servers).
I've tried to disable all firewalls, made firewall rules for TCP port 135, 1433, 1434 and 4022 and UDP port 1434 allowed for both in and out.
And servers has been set up for listening on port 1433. And the "SQL Server Browser" is running.
It is working with connection, but not able to browse them.
Does anyone know why, and if there is a fix for this?
I've solved my problem, it was caused by VMware workstation on the computers. I found out about this, by using the CMD "C:\Program Files (x86)\Microsoft SQL Server\90\Shared\sqlbrowser.exe" -c like mentioned in this thread.
By stopping the "SQL Server Browser" Service, and start it from the CMD you get to see what happens in the service, And it was not as I expected. It seems like that the virtual network adapters from VMware was causing the problem, because it looking like the SQL server browser was using the wrong adapters.
It might be because I've installed the VMware workstation before the SQL server. But anyway by removing the adapters and using only a bridged connection from the VMware for now, everything is working as expected.

How to connect to remote SQL Server through a vpn using python?

I currently have access to a SQL Server by connecting to the company VPN, then use "Remote Desktop Connection" to access a windows system where I can I then can use SSMS to access the company Server to use the specific database that I'm getting data from. I am trying to write a python code that will only make SELECT calls to an SQL Server that can only be accessed when using the company's VPN for automating reports.
From my current understanding:
I need the pymssql library to do this remotely
I need to make sure TPC/IP is enabled in "SQL Server Configuration Manager" under SQL Server Network Configuration->Protocols for MSSQLSERVER
Right-click on TPC/IP and click properties to get the IP address and port numbers that can be used to access the database
Check the Windows Firewall in Control Center to check if those port numbers are open
Then code
I have done all this and check the port number by doing netstat -ab in Command Prompt
TCP 999.999.999.999:1234 ServerName:0 LISTENING
[sqlservr.exe]
From my understanding this should be all I need to do since I use "Windows Authentication" to access the server.
import pymssql
conn = pymssql.connect(server='ServerName',
database='DBname',
port=1234)
If I run the code above I get
OperationalError: (20002, b'DB-Lib error message 20002, severity 9:\nAdaptive Server connection failed (ServerName:1234)\n')
I'm not sure if I'm making the TCP call at all or if I'm failing the "Windows Authentication". I'm not sure if I need to use my username and password for the VPN as well. Does anyone know how I need to get this connection to work?
Excess info if needed: I'm coding in python 3.7 and Microsoft SQL Server Manager Studio 2014

Issue with connecting to SQL Server 2017 for Linux

I have installed SQL Server 2017 on Linux Ubuntu together with SQL Command Line Tools.
Instantly after setting up and normal configuration I am unable to connect to it using the command line tools.
I am getting the following error:
How can I fix this issue?
I finally managed to fix the issue by reinstalling the SQL Server 2017 on my Debian machine.
Microsoft instructions are for Ubuntu not Debian but the only error I was getting on Debian was about OpenSSL which I solved it using the following answer:
https://askubuntu.com/questions/930712/installation-problems-with-ms-sql-server-for-linux
Now it works perfectly on my Debian machine.
Look here:
Configure a Windows Firewall for Database Engine Access
Configure a Server to Listen on a Specific TCP Port
Specifically:
Can not connect to MS SQL from Ubuntu sqlcmd
client
The fix for letting the Ubuntu client connect was to set "Listen to
All" to No in the SQL Server Configuration Manager > SQL Server
Network Configuration > Protocols for [instance name]. And under IP
Address change 127.0.0.1 to the [ip] used to connect. Don't forget to
restart the SQL Server!
Other tip: check your firewall (or temporaly disable it for testing).
Also allow remote connections in SQL Server properties > Connections.
See above posts.

Connecting Java EE application with Sql Server in virtual box

I have Ubuntu installed on my laptop, and I'm developing a web application with java, using eclipse, and I want to connect, with sql server. To do this I have installed sql server 2012 in my virtual machine(Virtual box).
I have installed windows 7. I'm using Bridged Adapter setting, to receive ip from dhcp.
I have tested connection with ping command and is running successful, but when I run my application I have this error: Unknown server host name 'PEACH-PC'
the PEACH-PC is the
have you added Peach-PC variable in the etc/hosts file? that may be the case. If not add the ip and the variable there.

SQL Server communication between VirtualBox images

I have a WinXP host with VirtualBox 3.1.2 installed. I have a VirtualBox image called "hydrogen" on which I installed WinXP and MS SQL Server 2005 Express. I have another VirtualBox image called "helium" on which I installed WinXP. I am trying to create a ODBC DSN on "helium" that connects to SQL Server on "hydrogen" but it fails.
All of the documentation I've seen so far only says to use a "bridged adapter" in my VirtualBox image settings. I've done that but I still don't have communication.
The express edition does not listen on remote ports by default. You can enable remote connections using the "Surface Area Configuration Tool" or by running this SQL script:
exec sys.sp_configure N'remote access', N'1'
go
reconfigure with override
go
Also, if you use a bridged adapter, your virtual boxes are sharing your host's IP address. That means you'll have to configure both instances of SQL Server on a separate port.
I've gone through a couple of tweaks and changes and I have it working. My environment:
Host:
WinXP Pro
SQL Server 2005
Guest "Hydrogen":
WinXP Pro
SQL Server 2005
Network Adapter #1: NAT
Network Adapter #2: Bridged
Guest "Helium":
WinXP Pro
Network Adapter #1: NAT
Network Adapter #2: Bridged
On "Hydrogen", I ran the Network Setup wizard, specifying that it was part of a network that did not have an internet connect (part of the "Other" option). I rebooted "Hydrogen".
On "Helium", I ran the Network Setup wizard, specifying taht it ws part of a network that did not have an internet connect (part of the "Other" option). I rebooted "Helium".
I turned off the firewall on "Hydrogen".
I can now connect to SQL Server on "Hydrogen" from both "Helium" and my host. Some of these settings may be extraneous; I don't know. But I know it's working for me reliably now, even after rebooting the host.

Resources