Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. Multi-user use the database at the same time

Multi-user use the database at the same time

Scheduled Pinned Locked Moved Database
databasesql-serversysadminquestion
4 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Siavash BRY
    wrote on last edited by
    #1

    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.

    R D J 3 Replies Last reply
    0
    • S Siavash BRY

      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.

      R Offline
      R Offline
      Richard Deeming
      wrote on last edited by
      #2

      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

      1 Reply Last reply
      0
      • S Siavash BRY

        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.

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        • S Siavash BRY

          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.

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          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.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups