HeidiSQL: Connect to SQL Server on non-standard Port - sql-server

I am trying to connect to a database instance on a box running SQL Server Express Edition. The instance is running on port 54759, rather than the default 1433 typically used by Microsoft SQL Server.
I can successfully connect using Microsoft SQL Server Management Studio, by specifying the server name as my-server-name,54759. However, when I try the same hostname in HeidiSQL I get the following error:
SQL Error(0): Operation is not allowed when the object is closed
unknown
I cannot find any option in HeidiSQL to change the default port for a Microsoft SQL Server instance, nor any reference to a particular syntax to use for specifying the port number.

Turns out the comma syntax does work in HeidiSQL after all: [server-name],[port number] in the Hostname/IP box.
The cause of the error must have been unrelated.

In HeidiSQL, the port for MS SQL Server connections can only be changed if you selected Microsoft SQL Server (TCP/IP). In that case you use the "Port" setting, below the "Password" field.
For the other network types - IPX, Banyans and RPC - you cannot define a port as that makes no sense in these protocols.

Related

Can't connect to a SQL Server named instance

I run several applications that require SQL Server. I usually use SQL Server Express. After the latest Windows 10 update, my profile became corrupted, so reinstalled windows. I had been wanting to play around with SSRS, so I installed SQL Server 2016 Dev edition. After installing, I tried to connect from SSMS using hostname\instance and Windows authentication and I got error 87
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)
I tried removing the instance name and just connecting using the hostname, and the connection succeeded. With SQL Server Express I always needed the instance name. Why is it no longer necessary?
When you connect without specifying an instance name, the client connects to whichever instance is listening on port 1433. This is typically the default instance. A named instance usually listens on a different port so either the instance name or port number must be specified in the connection string.
Unless you specify otherwise, SQL Server Developer Edition will install as the default instance (if no default instance already exists). In contrast, Express installs as a named instance (name SQLEXPRESS unless you change it) but you can explicitly install as the default instance if desired.

SQL Server 2014 Express on Windows 10

I've downloaded and installed SQL Server 2014 Express on Windows 10, I've been through this loop at least 3 times now. The installation completes without warnings or errors. I have chosen to use Window authentication. I'm trying to use HeidiSQL to connect to SQL Server. I already have MariaDB installation and am able to connect to that using HeidiSQL.
When I connect to MariaDB I am able to select Databases from the drop down combo, but not for SQL Server. I don't seem to be able to connect with HeidiSQL.
In HeidiSQL, the settings are:
Network type: Microsoft SQL Server (TCP/IP, experimental)
Hostname / IP: 127.0.0.1
Ticked checkbox 'Use Windows authentication'
Port: 1433
I can't select a Database, if I click on the Open button after a while it comes up with:
SQL Error(17): [DBNETLIB]ConnectionOpen (COnnect()).]SQL does not exist or access denied SQL Server does not exist or access denied.
In order to use HeidiSQL's network type Microsoft SQL Server (TCP/IP), you need to activate TCP/IP protocol in your MSSQL configuration.
Further on, I am unsure if Windows authentication worked for me, as I'm always using the default SA user, which is created while installing SQL Server.
Apart from that, you should be able to connect using <yourmachine>\SQLEXPRESS on port 1433.
Use Microsoft SQL Server (named pipe) as Network type and .\SQLEXPRESS for Hostname / IP
SQL Server Express by default installs as a named instance called SQLEXPRESS - so for your "hostname", try one of these:
.\SQLEXPRESS
(local)\SQLEXPRESS
yourmachine\SQLEXPRESS
your-ip-address\SQLEXPRESS
Those should work.

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.

Why might SQL Server 2008 OLE DB UDL require port 1433 explicitly specified?

In a production environment, I found that port 1433 must be explicitly specified for a "Microsft OLE DB Provider for SQL Server" UDL. Like this:
Provider=SQLOLEDB.1;User ID=USER;Data Source=IP,1433
Without the port specified, the error is:
Test connection failed because of an error in initializing provider.
[DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection.
Same environment, but SQL Native Client 10.1, does not require 1433 explicitly specified:
Provider=SQLNCLI10.1;Integrated Security="";Persist Security Info=False;
User ID=USER;Data Source=IP;...
Same test against a development SQL Server, OLE DB UDL does not require the default port specified.
Under what circumstances might it be necessary to explicitly specify the default port?
The production system is clustered, with a primary active and secondary passive, and a cluster server to which the connections are made. Development environment is just single SQL Server 2008. I don't know of any other differences. If you think this plays into it, why might that matter?
Client to SQL Server (where UDL was created):
Windows Server 2008 R2 Standard
MDAC 2.8
All SQL Database Servers:
Microsoft SQL Server 2008 (SP1) - 10.0.2734.0 (X64)
Windows Server Enterprise Service Pack 2
Thanks in advance for any help.
This is a known problem that is unique to clustering. The reason is that the cluster manager will answer on one IP/port and then hand-off communications to the actual(physical) server, which may communicate on a different port. It looks like there might not be a fix, but you have already found the workaround.
For more info, check out this Microsoft Technet article: http://support.microsoft.com/kb/318432
I've had to do this a few times. The two main causes are
1) Firewall
- Make sure port 2382 is open for the SQL Browser service and it is allowing external connections. More info: sql server firewall ports
2) Existing SQL alias - Open "Sql Server Configuration Manager". Expand "SQL Native Client 10.0 Configuration", Aliases. If there are any in the list, check to see if the Port has been set. Sometimes these entries get set when messing with ODBC server settings. Then they get stuck and it seems like they can only be removed/fixed via the SQL Config manager.

Connect to MS SQL Server

I am trying to connect to MS SQL Server hosted on a network. Windows authentication and SQL Server mode is enabled (both). I cannot connect
[DBNETLIB]SQL Server does not exist or access denied.
[DBNETLIB]ConnectionOpen (Connect()).
Can anybody suggest how to provide the server name when there exists a domain and please be explicit with slashes if any.
Assuming your client is on the same network and all of the DNS records are working correctly (try pinging the server to see if it's available).
You could try connecting using the IP address
If you are trying to connect to a named instance use server\instance
Check that you are not being blocked by the Windows Firewall on either your machine or the server (at the very least port 1433 will need to be open for a default SQL instance)
make sure you enabled the following in Configuration Manager :
SQL Server Network Configuration
- Protocols
--- TCP/IP - Enabled
SQL Server Network Configuration (32bit and 64bit)
- TCP/IP - Enabled
- Name Pipes - Enabled
and make sure SQL Server Instance is logged on as a domain account for you to be able to execute network backup.
try opening sql thru SSMS if named instance use IP/name of instance
else just the IP
and log in as "sa"

Resources