Issue importing database to database project in Visual Studio - sql-server

I have created a dev database in SQL Server and added a table in SSMS. I have created a .NET 6 application and created the database project and data project and now I am trying to import the database.
When I click select connection, it can find the database, if I select the Windows authentication option, it looks like it worked, but then the start button is greyed out.
If I select SQL Server authentication and try to use the login I have set up as db_owner in SSMS, I get this error:
Login failed 18456
I can login fine in SSMS as that login.
I am now stuck as to whether this is an issue with how I have set up the database and login user or whether this is an issue in Visual Studio. Please help!
I have checked that the login is set up as db_owner and systemadmin which it is.
I have also changed the default connection database for that user to the database rather than default or master.

Related

SSIS cannot connect to SSMS using SQL Server Authentication

I'm trying to set up a connection to SSMS from SSIS project I'm working on with SQL Server Authentication.
I set up a cube_user login and gave it permission to my database transactions
Here is how I set up my cube_user:
Login Name, password. I also chose the default DB below to transactions, the appropriate DB.
Then in User Mapping tab, I gave user owner permissions and I checked in the appropriate DB
Having done all that, it seems like it should work. I then started an SSIS project and tried to connect to it like this:
As you can the drop down that is supposed to display databases, is blank. However, If i tried to connect to it using Windows Authentication, I am able to see all DBs....
Is there something wrong I'm doing. Can you not connect to SSMS using SQL Server Authentication?
Please check the following things:
In properties of cube_user - that it has at least guest rights on the RDBMS (SQL Server itself). User rights on specific DB will not give the permission to connect to SQL Server. The properties are in SSMS - Security\Logins - specific Login properties - Server Roles. See example below
On the third screenshot where you specify user name and password - specify those of cube_user, not admin.
The reason why you see list of DBs with Windows Auth - you do it under your account which presumably has DBA user rights on the SQL Server.

SQL Server 2008 Cannot open user default database - error 4064

I have a database application which has been working fine in the past, but since restoring my server a few weeks ago the main user login has stopped working -
I get this error when I try to login from SSMS.
The default database is defined correctly for the user in question, and I can connect to (and query) that database using the sa user. The database is online, set to MULTI_USER, isn't set to emergency status, and isn't part of a database mirror. The user that is being denied access is not a member of a group, and I've confirmed that the default database is set correctly for that user. If I can connect to the database in question using the sa user then clearly there's a problem with my chosen user/login, but I've run out of ideas. Can anyone help?
I'm running SQL Server 2008 on a Windows 2008 Server.
You can get this error in following cases:
database does not exist
database cannot be open (is offline, is restoring, etc)
your login is not mapped to the database
If you are sure that database exists and is online, you user can be orphaned.
This means that the login's sid does not correspond to user's sid, this could be caused by restore.
You can fix tihis by altering your user with login:
alter user MyUser with login = MyLogin

Can't create new database user with full access in plesk 12.5

I'm trying to create a user for my sql server database in plesk 12.5 web panel but when I create a user, this user has limited role.
I can't change user privileges even though T-sql...
for example when I tried to copy one of my databases that is on another server to this server using Management Studio, I get this error in image below:
SSMS Database Copy Wizard Error
I want to create a user with owner role and full access...
this is my plesk options for ceating new database user:Plesk Options
I'm so confused that what's going on here!
in earlier versions of plesk I didn't face this issue...
any suggestion?
You can ask your hosting provider to switch on option
"Grant the ALTER DATABASE permission to all Microsoft SQL database users"
in Tools&Settings > Database Hosting Settings
or if you have access to RDP you can execute following command:
plesk sbin server_pref -u -grant-alter-database-to-mssql-users true

Cannot add user to SQL Server 2012 database

I am trying to add a user to SQL Server 2012 Express by right clicking the users folder and clicking add.
I am selecting "SQL user with login" and filling out login info but it is giving me this error:
I am running Windows Web Server 2008 R2. I have tried different names in case it was conflicting and no joy. There is already a user in another database that someone else added previously. I tried to add a user to that database and got the same error so I am not sure what they did differently to me.
I tried running SQL Server Management Studio as administrator but when I do that the add user dialog changes and only lets me create windows user, no sql with login option is there.
I have also tried with a query:
CREATE LOGIN loginname
WITH PASSWORD = 'pass'
It says it is completed successfully but no user is created.
Anyone know what I am doing wrong?
You need to create a login to the server, then a user in the database.
Create Login
Create Database User
If you successfully created loginname, at the server level folder in SSMS, double click on the login and you will see options to grant the user permissions to the necessary database as well as assign a server level role. Once the login is configured and you have given permissions to the database, you can look in the User folder of the database and see the user.
Also answered in:
How do I create a new user in SQL Server 2012 that I can use in a connection string?
Does your SQL user you're logging in with have priv to create a user? This is not the same as launching the application with an elevation (right clicking the shortcut, and clicking run as administrator).

SQL Server 2008 can't login with newly created user

I'm using using Windows Vista and I'm having trouble logging in with a newly created user.
I open SQL Server Management Studio.
I create a new Login by right-clicking on Security->Logins.
Check: SQL Server Authentication
Login name: tester
Password: test
Click OK
I added this user to User Mapping to my database of choice.
Click File -> Connect Object Explorer, select SQL Server Authentication and enter tester/test and click Connect.
I get an error:
Login failed for user 'tester'. (Microsoft SQL Server, Error: 18456"
with Severity = 14 and State = 1.
What causes this error and how do I login with my user?
SQL Server was not configured to allow mixed authentication.
Here are steps to fix:
Right-click on SQL Server instance at root of Object Explorer, click on Properties
Select Security from the left pane.
Select the SQL Server and Windows Authentication mode radio button, and click OK.
Right-click on the SQL Server instance, select Restart (alternatively, open up Services and restart the SQL Server service).
This is also incredibly helpful for IBM Connections users, my wizards were not able to connect until I fxed this setting.
If you haven't restarted your SQL database Server after you make login changes, then make sure you do that. Start->Programs->Microsoft SQL Server -> Configuration tools -> SQL Server configuration manager -> Restart Server.
It looks like you only added the user to the server. You need to add them to the database too. Either open the database/Security/User/Add New User or open the server/Security/Logins/Properties/User Mapping.
You'll likely need to check the SQL Server error logs to determine the actual state (it's not reported to the client for security reasons.) See here for details.
Login to Server as Admin
Go To Security > Logins > New Login
Step 1:
Login Name : SomeName
Step 2:
Select SQL Server / Windows Authentication.
More Info on,
what is the differences between sql server authentication and windows authentication..?
Choose Default DB and Language of your choice
Click OK
Try to connect with the New User Credentials, It will prompt you to change the password. Change and login
OR
Try with query :
USE [master] -- Default DB
GO
CREATE LOGIN [Username] WITH PASSWORD=N'123456', DEFAULT_DATABASE=[master], DEFAULT_LANGUAGE=[us_english], CHECK_EXPIRATION=ON, CHECK_POLICY=ON
GO
--123456 is the Password And Username is Login User
ALTER LOGIN [Username] enable -- Enable or to Disable User
GO

Resources