Microsoft SQL Express localhost connection - sql-server

I've been following up a tutorial (sql server 2008) and I'm a bit in a doubt.
It seems like it names my localhost with my Windows username by default and I need a confirmation about this because if I try to connect to the server name either : (local), . , 127.0.0.1 I'll get an error.
Here's the error when I try to directly specify localhost
I am a bit confused, sorry for the ambiguous question. It's just that I've been following up a tutorial but on sql server 2008.

(local)\SQLEXPRESS or .\SQLEXPRESS - you need to specify the instance name.
To use just (local), the machine name or IP without an instance name you would need to have installed SQL Express as the default instance.

Related

LINQpad can't connect to SQL developer server

I know this is a dumb question but it's really impeding my progress.
When using LINQpad I am able to easily connect to my SQL Server Express, but I cannot figure out the connection string for my SQLDEVELOPER server.
Here is the information I can find regarding my server:
Would this be enough information to figure out the connection string I need?
I have tried heaps of combinations of MSSQLSERVER / V-ADLWS12 / MSSQL14 and still nothing.
Thanks for any help
Check out the instance name column in your second screenshot:
the MSSQLSERVER instance is the default, unnamed instance which you can connect to use . (means: local server - this machine), (local) or localhost (or also: machinename)
Any other instance is a named instance, which you can connect to using .\SQLEXPRESS, or (local)\SQLEXPRESS, or localhost\SQLEXPRESS, or yourmachinename\SQLEXPRESS
If you're connecting to a remote SQL Server, just replace the . with the machine name of that remote SQL Server machine
....All I needed for the connection string was a dot.
.
I'm more happy than confused

How will I know the sql server database name to connect from SSMS

Installed SSMS 2017 version. When I launch it first time, it asks for server name to connect to. I installed SQL server 2014 already. But I don't know the name of the server. I tried giving server name as "local". But it wouldn't accept. It says "Cannot connect to to local" Error: 53
Since I installed SQL server on my local machine, "local" should be acceptable name as a server to connect to from SSMS.
server name?
.
localhost
127.0.0.1
Any of these will connect to sql server running on your local machine.
If you installed sql as a named instance, then .\myinstance, localhost\myinstance, etc
You can use (.), or local or localhost.
If you used named instance, follow the next:-
Use Browse for more, for getting the accurate server name as next screen shots;-
and under Database Engine, you will get the accurate server name
If you have Db connection you can use this command
select ##servername + '\' + ##servicename
you can also check SQL Server Configuration Manager.
In Configuration Manager you need to find SQL Server Service. When you Double click the SQL Service and navigate through Service Tab, you need to see SQL Server Name
It should be localhost, just setup my SQL server last month and had to find this information aswell.
You need connect using . only.
connect Local instance using .

HeidiSQL: Connect to SQL Server on non-standard Port

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.

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.

SQL Server Connection issues

I have 2 SQL Server instances installed on my Windows 7 :
First one : SQLEXPRESS - no specific database
The other one : MSSQLSERVER (classical) - several development databases...
Let's say my computer's name is SERVERNAME
Using connection string SERVERNAME\SQLEXPRESS is ok.
Using connection string . is ok and connects to MSSQLSERVER instance
Using connection string SERVERNAME does not work
Using connection string SERVERNAME\ does work (note the backslash).
Thus, until yesterday the SERVERNAME connection was working fine.
And everybody's telling me that the SERVERNAME\ connection is a abnormal one.
I've tried to connect with Windows authentication and SQL Server authentication, and cannot connect through SERVERNAME as my server name.
What should I do to recover previous functionality ?
Thanks in advance.
Regards.
You should always use SERVER_NAME\INSTANCE_NAME. In you above described scenario when you use . which means localhost it connect you the the sql server default instance name. but is it really safe to let sql server decide which instance to connect to? obviously not.
Let your connection string decide which server and what instance to connect to by using full path i.e ServerName\InstanceName. and do not worry much about other issue. as they say Keep it simple :)

Resources