I have setup SQLExpress on a Windows 10 PC and trying to access it via another PC.
I also configured my setup using this guide.
I was able to connect using SQL Server Authentication.
However, when I tried connecting using Windows Authentication, I received the following message:
The login is from an untrusted domain and cannot be used with integrated authentication.
Is there a step I might have missed?
You may need to launch your SSMS under a different set of credentials (runas) in order for it to connect via windows authentication. One way to do this is to create a simple batch file (or shortcut) to do so.
Create a batch file on your desktop and name it something like:
AltSsms.bat
Add the following line to the AltSsms.bat file:
runas.exe /netonly /user:{domain}\{username} "C:\Program Files (x86)\Microsoft SQL Server Management Studio 18\Common7\IDE\Ssms.exe"
Be sure to replace {domain} and {username} with the actual values expected by the remote computer, and provide the full path to your local SSMS installation. I've provided my SSMS path for reference.
Save the updates to the batch file and then double-click it to open it. You should be prompted to enter the password for the {domain}\{username} you specified in the batch file.
Once SSMS loads (and assuming you've entered proper credentials), attempt to connect to the SQL Server instance with Windows Authentication. I've had to do this with several SSIS setups.
Related
I need to connect to a remote database (Oracle) using a MS SQL Server (2019) linked server. What I did so far:
Installed Oracle Instant Client x64 and the ODBC drivers on the machine where the SQL server is running
Created a symlink to the central TNSNAMES.ORA (on a file share in the network) inside the Oracle Instant client folder.
Set the necessary environment variables
Created an ODBC connection to the database on the Oracle server on this machine
Restarted MS SQL Server
Created a linked server (Microsoft OLEDB Provider for ODBC Drivers) in the SQL instance
When connecting to the SQL Server using sqlcmd on this machine (I did not install SSMS there), I can query the linked database using OPENQUERY(). I can also read the file TNSNAMES.ORA using this command (note, the given file is the symlink, but it displays the contents of the linked file, as it should):
SELECT * FROM OPENROWSET(BULK 'C:\InstantClientx64\tnsnames.ora', SINGLE_CLOB) TNSNames
So far, everything is fine.
Now, when I connect to the SQL Server from my workstation using SSMS, i get the following error when trying to read TNSNAMES.ORA using the command above:
Cannot bulk load because the file "C:\InstantClientx64\tnsnames.ora" could not be opened. Operating system error code 5(Access is denied.).
I created a file test.txt in the instant client folder containing something like "Am I allowed to read this?" - and I was, no problems.
I started procmon on the server to find out what happens. When using the above command on the SQL server, I get a REPARSE (because it's a link!), and then SUCCESS, the file is displayed in the sqlcmd console.
When using this command in SSMS (on my local workstation), first appears the REPARSE (OK), then ACCESS DENIED.
In both cases it is the same user account which is displayed as "Impersonating" in the procmon's details. There is definitely no problem with a firewall, and the read permissions on the tnsnames.ora file on the network share are granted for Everyone. I am also able to create an ODBC item on the local workstation, and can connect and query the database from here.
I have done this in the past I don't know how often, and never had problems. What am I missing?
Why are you trying to read the tnsnames.ora file via SQL? The Oracle libraries will (should) internally open it and use it when your app connects to the DB.
The default location for network config files is shown in the Instant Client installation doc. In your case it will be C:\InstantClientx64\network\admin. Unless you have set the TNS_ADMIN variable, then start by creating this subdirectory and putting tnsnames.ora in it.
(A future version of Instant Client on Windows will create the network\admin subdirectory automatically, similar to the way it is created with the Linux Instant Client packages).
I'm using a VPN to access a remote SQL Server. Normally I would run SSMS on my machine and use SQL Server Login for access. However, this server is set up to allow in only a particular user using Windows Authentication. I can access the DB by RDPing to that server and using SSMS on that machine, but is there any other way to do it from SSMS on my local machine?
Simplest way:
open up a command line window - cmd.exe
do the following: runas /user:<domain>\<alias> cmd.exe
enter your password when prompted
do the following: ssms.exe
it should now launch SSMS.exe under the account in #2 above.
I have a SQL Server login created (Windows Authentication) and SQL Server user linked to the login.
I want to test the connection to this SQL Server from another server on the network for this particular Active Directory account (different than my AD account). I do not have a SSMS(SQL Server Management Studio) installed on the server I want to test the connection from.
How can I do that?
Figured it out. Here is how I tested it:
Create a Microsoft Data Link file (.udl) anywhere on the client machine. Just create a new test.txt file and rename it to test.udl
Opening the properties dialogue of .udl file lets you test the connection to a SQL Server. My problem was that the connection to the SQL Server needs to be tested for an AD account different than mine. To do this, run the command prompt as that user on the client machine:
In command prompt, navigate to the folder that contains test.udl file and type the name of the file in the prompt.
This will open the properties of the .udl file. Go to Connection tab and provide the SQL server name:
Select "Use Windows NT Integrated security" in section #2:
When you click on the database drop-down in section #3 and you are able to see the list of databases, that means that the login worked for the user. If you wish you can select a database from the list and click "Test Connection" button to test a specific database connection.
Using SSIS for SQL Server (2012 or later) Standard Edition, I want to connect to a remote Oracle database using Windows authentication.
In my tests, this works fine when using sqlplus:
sqlplus /#MyRemoteConnection
In SSIS (using either ADO.NET or OLE DB Connection Managers), the connection
succeeds when specifying the user id and password.
The connection fails when specifying the "/" user (without a password) in the SSIS connection.
Is authentication through Windows supported at all for SSIS connections to Oracle?
If yes, how do I do this?
If Windows authentication is not supported, are there other tools which allow me to connect from SQL Server Standard Edition (that's why e.g. Attunity cannot be used)?
All suggestions are highly appreciated!
Yes, Windows authentication from SQL Server Standard Edition to Oracle is supported.
A valid ADO.NET connection string (e.g. using Visual Studio (SSIS), or the Import Wizard in SQL Server Management Studio) may look like this:
Data Source=<host name>:<port number>/<database name>;Integrated Security=SSPI;
An example:
Data Source=my_host_name.com:1521/ORCL;Integrated Security=SSPI;
For Windows Authentication, "Integrated Security"
needs to be set to "yes", "True" or "SSPI".
A valid OLE DB connection string looks like this:
Data Source=<host name>:<port number>/<database name>;User ID=/Provider=OraOLEDB.Oracle.1;
Example:
Data Source=my_host_name.com:1521/ORCL;User ID=/Provider=OraOLEDB.Oracle.1;
Please note:
The port number is optional and can be omitted if the standard port number (normally 1521) is used.
When using SSIS, the Connection Manager may complain with the message
"The given path's format is not supported."
This happens if the port number is specified in the connection string.
The connection string (including the port number) will work nevertheless, if the connection string is filled by a variable in an expression.
Further requirements:
On the file system (both on the client and the server), there has to exist a file sqlnet.ora.
This file has to contain the string
SQLNET.AUTHENTICATION_SERVICES= (NTS)
On the database server, and when using a full Oracle client,
the file sqlnet.ora should be located in the ORACLE_HOME\Network\Admin directory.
ORACLE_HOME normally is defined in the registry, under
HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE
If an Instant Client has been installed, the file sqlnet.ora can be put in the "network\admin" subdirectory under the directory where the Instant Client is located.
Please note that the Instant Client will not look into the registry to use (or evaluate) ORACLE_HOME.
Therefore sqlnet.ora files located there won't be read when trying to connect to the Oracle server!
(That's the reason why my connections failed all the time.)
Another option is to specify a directory for sqlnet.ora by setting the environment variable TNS_ADMIN, e.g. in the Windows Control Panel.
Example:
TNS_ADMIN=C:\TNS_ADMIN
Then, put the file sqlnet.ora into this directory.
On the Oracle server, the Windows user needs to exist.
Example:
create user "OPS$MYDOMAIN\MY_USER_NAME" identified externally;
grant create session, alter session to "OPS$MYDOMAIN\MY_USER_NAME";
(additional privileges may be required.)
Then it should be possible to connect to Oracle as Windows user MY_USER_NAME,
using Windows Authentication.
I installed sql server mgmt studio 2008 r2. i used default instance (MSSQLSERVER) user name, added current user and used the default windows authentication. but when I logged in, i couldnt even logged unless i use "(local)" as server name. I tried using MSSQLSERVER, SomePCName\MSSQSERVER but still I couldnt log in. I tried enabling those protocols on Configuration manager but still I couldnt log in. Anyone here know how to fix this?
Run SQL Server browser service.
It's disabled by default.
Using Configuration Management tool(not ssms), enable the service and set start mode automatic.
Below are some points you can check
1) Disconnect your machine from network then on command prompt write following command
SQLCMD - L
The output of this command will be SQL SERVER name installed on your machine. You can use these names to connect.
If you face still the same issue then as my friend mentioned check browser service & SQL Server service whether they are up or not.