Connecting to MS SQL Database from Pentaho - sql-server

I am trying to connect to sql server from Pentaho. I have created a user on the database and I am able to connect with that user from Pentaho. However, the user seems to require the sysadmin server role. Without that role, the user is unable to connect from Pentaho. The error message from Pentaho simply states that the login failed for user.
The user is able to login without the sysadmin role from the SSMS application.
Does a user seriously need to be a sysadmin to connect from Pentaho?

No, user should not be sysadmin in order to connect to sql server from Pentaho. Create login first then map that login to user. Use the below commands.
create login login_name with password ='acds'
create user user_name for login login_name with default_schema='schema_name'

Related

Using Windows Authentication and SQL Server database

Do you know whether a SQL Server connection can be authenticated via Windows Authentication but using a not exclusively the Windows Identity/Windows User Name but also a DB login name?
That is, could an SQL Server database have a login that is mapped to a Windows ID so that when you request a database connection you can specify a user name but yet SQL Server knows to look at the Windows authentication ID and validate the login?
could an SQL Server database have a login that is mapped to a Windows ID so that when you request a database connection you can specify a user name but yet SQL Server knows to look at the Windows authentication ID and validate the login?
No. When you connect with Windows Integrated Authentication you'll be connected as a Windows Login, and for each database you execute statements as the user mapped to that Windows Login (or as dbo if the login is a member of the sysadmin server-level role or the Windows Login is the owner of the database).
You can grant that Windows Login or mapped user the privilege to impersonate some other login or user, but it requires a separate command to perform the impersonation (execute as user='someuser'.

Azure SQL is not letting me create a SQL User

I have a Database server created in Azure [not a managed instance] and a Server Admin user was created, many SQL users were added and they were able to login without any issues. Now all of a sudden, SQL users I newly create can't login. It's giving Login failed message with Error# 18456
Here are the SQL commands I am using to create the user [after logging in as Server Admin]:
CREATE LOGIN reportslogin WITH password='' - this in "master" database
CREATE USER reportsuser from LOGIN reportslogin - this is in MyDatabase
ALTER ROLE db_datareader ADD MEMBER reportsuser - this again is in MyDatabase
Now I disconnect the server and when I try reconnecting to the server using the reportsuser, I get this:
What am I doing wrong?
Actually, the error is caused by you database login name.
You should using the Login reportslogin to login the database, not the username reportsuser !
We must using the login name to access the Azure SQL database, not the username.
A login is a simple credential for accessing SQL Server. For example,
SQL Login is for Authentication and SQL Server User is for Authorization. Authentication can decide if we have permissions to access the server or not and Authorization decides what are different operations we can do in a database. Login are created at the SQL Server instance level and User is created at SQL Server database level.
Please reference:
Login and SQL User
Difference between a User and a Login in SQL Server
Suggestions:
create the login and user with the same name:
USE master
CREATE LOGIN reportslogin WITH password='Xunmi110'
USE user_database
CREATE USER reportsuser FOR LOGIN reportslogin
ALTER ROLE db_datareader ADD MEMBER reportsuser
One login for one user.
Hope this helps.

Server principal already exists but doesn't show in SSMS

I have created Logins in Azure SQL via SSMS on two other environments, but on the third Azure SQL Server, the same exact SQL command creates logins but they don't show in SSMS. I am using these Logins to then users for databases. As I have stated it has worked on every other Azure SQL Server.
However, when I create my Logins, they don't show up under Security > Logins and if I try to create user for the db, I get the following error:
'myuser' is not a valid login or you do not have permission.
Here is my SQL to create the Login:
CREATE LOGIN myuser WITH PASSWORD = 'p#ssword';
Here is my SQL I run on a selected database to add the above created user with execute rights:
CREATE USER [myuser] FROM LOGIN [myuser];
GRANT EXECUTE TO [myuser]
To be clear, the Login (first SQL) said that it is created, but it doesn't show in SSMS and doesn't allow me to create Users in the DBs

Can't connect to SQL Server Express database

I'm new to SQL Server Express, I'm running on a vagrant on SQL Server 2012 Express.
I configured user and password and I'm able to connect to the server, but when I add the name of the database I want to connect to it prompts with invalid user/password combination.
I created the database:
CREATE DATABASE db_user1
GO
And I have created the user using:
CREATE LOGIN [user1] WITH PASSWORD='user1'
GO
CREATE USER [user1] FOR LOGIN [user1] WITH DEFAULT_SCHEMA=[dbo]
GO
With no errors.
I had to add the new user to the sysadmin group.

Why i can not delete user log in in my database?

i connect the sql server windows authentication and create a simple database and table on it,and so define the new log in user and set to sql server authentication,every thing is fine,but i connect the database with windows authentication too,i want to delete the windows authentication,and i want just connect that database with only sql server authentication,this picture for that problem:
when i connect with sql server authentication,i define the rajabi user log in.
but i want just rajabi user can be connect to this database.how can i solve that?thanks.
What if any roles have you granted the new user? Granting the reader role to the new user should allow said user to connect.
Right click on your user -> Properties -> Membership -> Anything checked? I usually check the db_datareader just to allow a user to connect.
Please run on your database
DROP USER [UserAccount]
CREATE USER [UserAccount] FOR LOGIN [UserAccount]
EXEC sp_addrolemember N'db_owner', N'UserAccount'

Resources