how do I access SQL server database from another computer?

  • Hi! I was trying to access SQL server from another pc in the Connect to SQL server window. Then a error window appeared saying 'Unable to connect to server DPC (computer name). Server: Msg 18456, Level 16, State 1. [Microsoft][ODBC SQL Server Driver][SQL Server]Login failed for user 'DPC/Guest'. How can I fix this error?

    How can I access SQL server database from another computer?

    In programming it in Microsoft C# .net, how will I write the code to access database from another computer? 

    Thanks! 

  • Get your DBA to create you a login on the SQL server and pass that information in your database connection string (sorry don't know C# so I couldn't give you the syntax)



    Shamless self promotion - read my blog http://sirsql.net

  • how do create a login on the SQL Server?

  • Is this a server maintained by yourself? Or do you have a dba for general SQL administration?

    If you are tasked with creating the login you would need to be at least a Security Admin within SQL to add a login.



    Shamless self promotion - read my blog http://sirsql.net

  • thanks for the help!  i was able to connect the 2 computers already

    However, i have another problem. When i was accessing the database from the server an error occured, 'Server user DPC/Guest is not a valid user in database 'SPCProduction' '(a database i created). And when i was checked SPCProduction in the SQL Server Login Properties Database Access, an error also occured, 'The user cannot be mapped to a login name.'

    How can i access SPCProduction from the other computer?

     

  • you have to do 2 things:

    1- make a login ... this is done from EM under security .. under logins .. then right click .. new login

    it is recommended to make SQL Server authentication .. by putting a password for that user

    2- then in EM .. go to your DB .. and under user .. right click .. New db user

    in login name .. choose the login you write before and click ok

    the double click on this user again .. and press permissions .. and put (~/) true sign to the permissions you want to give to that user on your tables, views, Stored procedure , .. etc

    I hope this help u


    Alamir Mohamed
    Alamir_mohamed@yahoo.com

  • An easier way is in Enterprise Manager, go to Security>Logins. Double click on the login and on the Database Access tab in the upper window check the box to the left of the database you will access and in the bottom window click on the type of access (ie. datareader).

    If you need to grant specific access, then do it the way alamir suggested.

    BTW - why is your login GUEST?

    -SQLBill

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply