I want to connect my SQL server management studio which is running locally with a Azure SQL Server 2012 database
Now i have enable the sa account on the SQL server side and i also check the server name by running this query --
SELECT ##SERVERNAME
I got the output
MSRV01\SQLSERVER
Now from my local machine when i am trying to loginto that Azure SQL server like this --
It retun this error
Do any one have any idea what i am doing wrong here !
Unless your local machine is on the same domain (or even subnet) as the azure VM then accessing via machine hostname will never work.
If you are using an Azure hosted database (i.e. not a VM) then in your Management Portal, navigate to the database settings panel. At the top will be listed the Server name with a URL like xxxxxxxx.database.windows.net. Use this to connect to your database in SSMS.
Further reading: https://azure.microsoft.com/en-gb/documentation/articles/sql-database-connect-query-ssms/
Related
I use SQL Server Management Studio. I want to connect the local server. But, I am missing the local server name.
I entered local, localhost and ., but it couldn't connect.
How can I get the local server name in SQL Server Management Studio?
Please let me know which path you can check.
A network related or installer-related error occurred while establishing a connection to SQL Server. The server can not be found or inaccessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
Other way to find is , drop down the server name box, at the end there is an option called . click it and there database engine , expand the database engine and u ll find the list of sql servers in your pc/network. Click the required one and u ll get servername .
Just write SELECT ##servername and run in your SQL Server Management Studio.
It will return the name of the current servername you are connected with.
The alias (local) (yes, including the parentheses) should allow you to connect to your local instance, but please supply the actual error that's occurring, in case the hostname isn't the actual problem.
From your question I assume that you're logged on to the machine that is running SQL Server. If so you can open SQL Server Configuration Manager to confirm the name of your SQL Instance. SQL Server Configuration Manager shows all of the SQL Services Running. Look for the one called SQL Server (instanceName) and note the instance name. You can then access the server from SQL Server Management Studio using either (local)\instanceName, .\instanceName, or servername\instanceName.
I am trying to sync to tables on differenet servers (Local one and remote one) using this code that I rum from the command prompt:
"C:\Program Files\Microsoft SQL Server\120\COM\tablediff.exe" -sourceserver localpc\SQL2014 -sourcedatabase localdb -sourceschema sche -sourcetable table1 -destinationserver remotepc\SQLEXPRESS -destinationdatabase remotedb -destinationschema sche -destinationtable table1 -et Difference -f d:\table1_differences.sql
but I recieve the error : unable to access database remotedb
The local db is SQL server 2014 express edition
The remote db is SQL server 2014 express edition
Firewall is turned off.
I assigned the admin user as the logon account for the sql service on the remote server.
NOTE I can connect to the remote db normally from C# application or from my local SQL server .
Thanks,
Solved it by assigning the -destinationuser and -destinationpassword parameters
I want to remote restart or stop SQL server service on SSMS. When I login in a DB using sa account, the menu bar still be disabled
I looked up some information, MS seems to disable it for security reasons from SQL server 2012
If there is any possible, I can alter some system settings to do that?
So to stop/restart an SQL Server instance from Object Explorer in SSMS, you would have to met the following requirements:
1. You must have to have at least public server role on the SQL Server instance.
2. You must have the privilege to start/stop services on the server that hosts SQL Server instance. For example, add your windows user to administrator group on the server.
Also,since SA uses SQL authentication, the best you can do is issue a SHUTDOWN command to stop SQL Server.
I built a window application in visual studio 2010. It is working fine at my computer.
if i have a pc that works with windows server 2008 and i install a sql server on it , how to make my application connect to database in the sql server that instaled in the server pc .
my pc connected to the server domain .
thanks
Assuming your application is already configured to use a Sql connection string, you'll just need to configure it for the Sql Server instance you're connecting to.
For example, if your database is called MyDatabase, and your windows server on your domain is called myserver.local, and you've installed Sql Express with the default SQLEXPRESS instance name, you could create your connection string (assuming ADO.NET) something like this:
Integrated Security=true;Initial Catalog=MyDatabase;Data Source=myserver.local\SQLEXPRESS
This configuration would be for Windows Authentication (Integrated Security=true): so your domain user accounts would need to be granted LOGIN rights on the server, and those Logins associated with USERS and ROLES in your database. If you wanted to use Sql Logins instead (generally requires extra configuration when setting up your Sql Server), there are different connection strings settings for specifying username and passwords. There are many options available for the connection strings as documented here: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.connectionstring(v=vs.110).aspx. However, with Windows Authentication the only 3 you absolutely need are the ones shown above.
You can test connectivity to your Sql Server from your PC on the network using Sql Server Management Studio, which will enable you to verify the instance name and the authentication is working as expected if you can connect to the database.
My desktop machine has SQL Server installed. I can connect to it (using my desktop machine) using the following server name:
localhost\SQL_Express
Windows Authentication
If I want to connect to it using my Laptop, I try to do the following (ACER_ASPIRE is my computer name):
ACER_ASPIRE\SQL_Express
SQL Authentication (acerAspireUserName, acerAspirePassword)
I get an error saying the server wasn't found. How can I go about connecting to my desktop machine's SQL Server from my Laptop?
To connect to a Sql Server you need to specify two things.
1 - Server name
In this section you are suppose to provide [ServerName\InstanceName]
Server Name is the Machine Name where your sql server Instance lives. And obviously since sql server can have multiple instances on one machine you need to provide the instance name that you want to connect to.
There is an exception for Instance name if you are connecting to the Default Instance you dont need to provide full [ServerName\InstanceName] you can only use the machine name to connect to the default instance on sql server on that machine.
One thing you need to know is
localhost == . == MachineName == ServerName
These are all different ways you can tell sql server , the server name that you want to connect to.
2 - Authentication
You have two ways to authenticate yourself when connecting to sql server,
Windows Authentication.
Sql Server Authentication.
In 1st section ServerName you told sql server that which machine and what instance you want to connect to.
Now in this Authentication Section you will have to tell sql server how you will be Authenticated.
When using Windows Authentication Sql server will use your windows credentials to identify you. This has nothing to do with the Server/Machine name it is to do with the Operation system of the machine, in your case it is windows and you can use your windows credentials.
On the other hand if you use Sql Server Authentication you will have to use a Sql Server Login' andPassword`. In this case sql server will not care what operating system you have on your machine. (mostly used when you are working on operation systems other than windows like Linux, Unix, Mac). It will only take consideration the login and password you pass.
Authentication Mode
What Authentication Mode you can use? this depends on your sql server configuration when you were installing, You can set your sql server to Only Allow Windows Authentication or Mixed Mode (i.e Windows Authentication and Sql Server Authentication).
Your Case
In your Case regardless of what Authentication Mode you are using. You can use any notations in sql server SERVER Section as long as they point to your machine like
local, localhost, . , ACER_ASPIRE
But for Authentication if you are using Sql Server Authentication Make sure you are using a Valid Sql Server Login and Password.
Open the query window, and inside it execute the following:
EXEC sys.sp_configure N'remote access', N'1'
GO
RECONFIGURE WITH OVERRIDE
GO
This option is not enabled by defauld on Express edition.
By default, SQL Express doesn't support LAN Connections, only from local machine.
To use it you must configure to listen to network ports also. You can do that on the SQL Server Surface configuration tool.