.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Post New Web Links

Can't connect using SQL Authentication

Posted By:      Posted Date: October 16, 2010    Points: 0   Category :Sql Server
 

Hi!

I am doing some tests here with SQL Server. Using the management studio I can connect to the server using my Windows user. Using that, I want to create a user and access a database.

I went to the security folder, added a login, selected the SQL authentication, set the user and password.

After that I added a user in the database using the login I just created (I gave the same name to both).

When I try to open a new connection, I select SQL Authentication and input the user and password, but I get an error that I can connect:

 

===================================

Cannot connect to localhost.

===================================

Login failed for user 'qwe'. (.Net SqlClient Data Provider)

 

Am I missing something?

 

Thank you,

Oscar


http://theitphilosopher.blogspot.com/


View Complete Post


More Related Resource Links

can't connect via SQL authentication - sql express 2008

  
Hello, I just installed SQL Express 2008, and for some reason I've 2 instances. one SQLEXPRESS and one MSSQLERVER. when i try to connect to 127.0.0.1 via SQL authentication, it works. when i try to connect to 127.0.0.1\SQLEXPRESS via SQL authentication, it doesn't work, but it works for windows authentication. how can i fix it? i want to connect to 127.0.0.1\SQLEXPRESS. Thanks, Gidi.

SOS: Cannot connect to SQL Server 2005 locally by Windows Authentication DOMAIN \ myname. But networ

  
Cannot connect to SQL Server 2005 locally by Windows Authentication DOMAIN \ myname. But network connection is successful.   But SQL Server Logins contain   BUILTIN \ Administrators, and                                                    BUILTIN \  Administrators contain DOMAIN \ Domain Admins, and                                                    DOMAIN \ Domain Admins contain DOMAIN \ myname.   Creating SQL Server Login with DOMAIN \ myname entail successful local connection.   Removing SQL Server Login with DOMAIN \ myname and creating SQL Server Login with DOMAIN \ Domain Admins do NOT entail successful connection. Cannot connect! System:   Windows Server 2008. Error 18456

Cannot connect to SQL Server 2005 locally by Windows Authentication, but network connection is succe

  
Cannot connect to SQL Server 2005 locally by Windows Authentication DOMAIN \ myname. But network connection is successful.   But SQL Server Logins contain   BUILTIN \ Administrators, and                                                    BUILTIN \  Administrators contain DOMAIN \ Domain Admins, and                                                    DOMAIN \ Domain Admins contain DOMAIN \ myname.   Creating SQL Server Login with DOMAIN \ myname entail successful local connection.   Removing SQL Server Login with DOMAIN \ myname and creating SQL Server Login with DOMAIN \ Domain Admins do NOT entail successful connection. Cannot connect!                                     &

C# connect SQL server 2008 window authentication on workgroup

  

We have an application winform C# that connects to sql server 2008 with window authentication impersonation.
We need window authentication because of filestream requirement (we did not find other solution).

The application works fine in domain environnement. Our msi create same user on each computer and we use it to access to remote database.

But a lot of our customer are littre company (1 to 10 employees), they are in workgroup configuration, it is impossible to migrate them on domain environment.

We tried to impersonate but it doesn't works in workgroups :

public void Impersonate(string userName, string domainName, string password, LogonType logonType, LogonProvider logonProvider)
  {
   UndoImpersonation();
 
   IntPtr logonToken = IntPtr.Zero;
   IntPtr logonTokenDuplicate = IntPtr.Zero;
   try
   {
	// revert to the application pool identity, saving the identity of the current requestor
	_wic = WindowsIdentity.Impersonate(IntPtr.Zero);
 
	// do logon & impersonate
	if (Win32NativeMethods.LogonUser(userName,
		domainName,
		password,
		(int)logonType,
		(int)logonProvider,
		ref logonToken) != 0)
	{
	 if (Win32NativeMethods.DuplicateToken(logonToken, (int)ImpersonationLevel.SecurityImpersonation, ref logonTokenDuplicate) != 0)
	 {
	  var wi = new WindowsIdentity(logonTokenDuplicate);
	  wi.

Cannot connect to local server with windows authentication

  

When I try to connect to my local server using windows authentication I get the following error:

Login failed for user 'Will-PC\Will'. (Microsoft SQL Server, Error: 18456)

 

It happens if I try to give the server name as WILL-PC, (local), localhost, or "."

I am on Windows 7, and I am using SQL Server 2005 Standard edition, the and SQL Server service is running.  I can't get into the server in any way to see what users are available.  Please help!


Net.TCP Endpoint; Windows Authentication security; client can connect to a server at localhost but n

  

Hey all, so here's what going on:

Situation
I have a WCF Service that I have setup as a Windows Service.  Everything works perfectly when I attempt to use the system with all of the components (i.e. server and clients) on the same machine.  However, when I try to connect my client from a different system, I get an error that is trying to tell me that the server rejected the client's credentials.

Objective
I need the client to the able to connect from a different machine.  I want to implement a SQL Role Provider kind of credentialing in the future, but for now, I just need it to work.

What I have tried
I have looked around online and read a few other posts as well some things in the MSDN KB and I have either not found the answer, or not understood it.

  • I have tried setting the <security mode="Transport"> to "None" with the hope that that would disable the accreditation entirely.  All it did was result in a different error saying that there was an error that might have been caused by an invalid message.  I have also tried a few other configurations with this element in the app.config file; to no success.
  • I have read some things about Impersonation, but I am not quite sure I understand how to implement it

Can't connect to local database file .mdf using SQL Server Authentication?

  

Using  - Visual Studio 2005 Professional, SQL Server 2005 Express, WinForms App

Problem - I am unable to connect to SQL Server local Database file (.mdf) through  SQL Server Authentication.

Description -

I am addding a SQL Database file (local) in the c# winapp solution by right-click -> add new item -> SQL database file.

It adds the file, starts a wizard to create datasets and tableAdapters. Dataset files (.xsd) are created in solution. In the Data Connection pane along ToolBox we can see Database1.mdf.

When i right click on databse1.mdf -> Modify Connection.

It shows a form with Test Connection option. The connection gets tested for Windows Auth.But for SQL Server Auth it shows following error message -

When User Instance = True

Error 1 "Failed to generate a user instance of SQL Server. Only an integrated sonnection can generate a user instance. The connection will be closed"

When i set User Instance = False it shows this message -

Error 2 "An Attemp to attach an auto-named database for file C:\Doc&Sett\Admin\MyDocs\VS2005\Projects\SamApp\SamApp\Database1.mdf failed. A database with the same name

SQL Authentication within SQLExpress Not Able to Connect to SQL User from Visual Studio?

  

I detached a database from sql server 2005 to an mdf file. I am able to logon to this mdf file from server management studio within sqlexpress instance using the sql user/pwd with no problem.

Within Visual Studio however, if I try to connect useing  the Server Explorer, I receive the error:
"Failed to generate a user instance of SQL Server. Only an integrated connection can generate a user instance. The connection will be closed."

I went into Advanced Properties and changed User Instance to False, and then get this error:
"Create Database Permission denied in database "master". An attempt to attach an auto-named database for file "c:\......mdf" failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

I opened the database again in management studio and detached it from sqlexpress, but still get same errors.


This issue is similar to the one posted here
http://social.msdn.microsoft.com/Forums/en-US/sqlsetupandupgrade/thread/ec9f1ded-1b9e-476d-acd9-77caf79a47b4/

but unfortunately for me, none of the suggestions in that po

How to connect to a different SQL server by using Windows Authentication?

  

Hi all

Version: SQL Server 2008 R2

When I use my SQL Server Mgt Studio -> Connect... Database Engine... then click on Authentication: Windows Authentication, my username is gray out and it grabs my current domain\username. I need to type a different Domain\Username.

How do I do that if the field is grayed out?

Thank  you


JCD

how to connect remote sql server on non domain network using SQL Server authentication

  

Hai.

i m newbie on sqlserver.I had manage to build a database (MS SQL SERVER 2005 standard) with a vb.net 2008 and tested well with local machine. and wanted to put a software on client. and   some-how manage to stucture a security model on server authentication. but still not clear on user management. and others.

will anybody help me step by step how to connect remote sql server on non domain network using SQL Server authentication

 

Thanking you advance

 


Inaocha

Explained: Forms Authentication in ASP.NET

  
This module explains how forms authentication works in ASP.NET version 2.0. It explains how IIS and ASP.NET authentication work together, and it explains the role and operation of the FormsAuthenticationModule class.

Using Forms Authentication in ASP.NET - Part 1

  
Classic ASP developers often had to "roll their own" authentication scheme, however, in ASP.NET much of the grunt work has been taken out. This article outlines how things have changed and how FormsAuthentication can be used to secure a Web site with a minimal amount of code.

ASP.NET Forms Authentication - Part 1

  
Often, in legacy Web applications, users authenticate themselves via a Web form. This Web form submits the user's credentials to business logic that determines their authorization level. Upon successful authentication, the application then submits a ticket in the form of a cookie, albeit a hard cookie or session variable. This ticket contains anything from just a valid session identification access token to customized personalization values.

ASP.NET forms authentication with roles

  
.A timeout is specified in minutes. This is "time since last request" not the "time since login". If a login is indicated to be persistent (described later) this is ignored.
.A protection method is specified for the cookie.
Next I wanted to specify a folder to which access is restricted to people who have logged in. To do this I entered the following code in the web.config file (beneath

Forms Authentication in ASP.NET

  
In this tutorial you will learn about Forms Authentication in ASP.NET 2.0 - Forms Authentication class, Cookie Domain, Forms Cookies, The Login Control, Signin, Signout, Authenticate, Redirect, Login Status, Login Name and Login View Controls.

InfoPath 2010 cannot connect to SharePoint 2010

  
You have installed Office 2010 beta and you are trying to connect to SharePoint 2010 from InfoPath but you get an error

could somebody give me example how I can connect to database only once if I use many models in contr

  

I use in my ASP.NET MVC application repository pattern and I use in controller for example 3 models:

   namespace MvcApplication1.Controllers  
   {  
        public class HomepageController : Controller  
        {  
            private IWebsitesRepository _repository_websites = new WebsitesRepository();  
            private IFirmRepository _repository_firm = new FirmRepository();  
            private IPhotosRepository _repository_photos = new PhotosRepository();  
      
     
           ...............  
       }  
   }  

In WebsiteRepozitory, FirmRepository and PhotosRepository classes I have:

Database1Entities _entities = new Database1Entities();

So I have 3 connections to database ? Is it wrong ? How can I solve it ?


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend