Multi-user use the database at the same time
-
When we have multiple users, What's the best way connect(logging, query on tables,...) to database? Which is better and why? 1) Create users(DB User) in the SQL Server for each user(Windows App User). 2) Create a table which is fill with all App user and just connect to SQL Server with a user and query on that table.
-
When we have multiple users, What's the best way connect(logging, query on tables,...) to database? Which is better and why? 1) Create users(DB User) in the SQL Server for each user(Windows App User). 2) Create a table which is fill with all App user and just connect to SQL Server with a user and query on that table.
The only possible answer to that question is "it depends". There is no single "best" option; that's why there are different options available. Each option has both benefits and drawbacks, depending on your specific requirements. For example, if you use SQL Authentication, then you have to store the SQL credentials somewhere on each client machine that needs to access the database. That runs the risk that a technically-minded user could find the credentials and connect directly to your database, bypassing the restrictions implemented in your code. You would have to deliberately design your database to restrict what the SQL user could do in order to mitigate this. On the other hand, if you're using a web application / api to access your database, then that will typically run as a highly restricted local user on the web server. Setting that up to use Windows authentication is more effort than using SQL authentication. And since all requests would effectively be running as the same local user, you wouldn't be able to use the authenticated user to restrict access to the data.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
When we have multiple users, What's the best way connect(logging, query on tables,...) to database? Which is better and why? 1) Create users(DB User) in the SQL Server for each user(Windows App User). 2) Create a table which is fill with all App user and just connect to SQL Server with a user and query on that table.
There is no such thing as "the best option". There is only what is the most appropriate given the requirements for the application, the application type, and the environment it's running in, which we know nothing about. There are far more options than just the two you listed.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
When we have multiple users, What's the best way connect(logging, query on tables,...) to database? Which is better and why? 1) Create users(DB User) in the SQL Server for each user(Windows App User). 2) Create a table which is fill with all App user and just connect to SQL Server with a user and query on that table.
I am going to guess you have an application. Users (plural) use the application not the database. The application, not the users, use the database. So there is only one user which is only visible to the application. The reason for this is because attempting to manage users both at the database and application level rapidly becomes a problem and provides no benefit. The application itself, should provide a mechanism to validate each user. Then you can do things like log actions, in the application, for each user in the database (a table for that.) The application will use the database to implement this but it does not have anything to do with database users.