Hi all,
This is ridiculous they teach so much at uni except what you need to know to program :-/ haha.
This is actually gonna be a 2 part question but I'll do it one at a time.
So I'm developing a small program for a company, this company has a server that runs sql server, what do I have to do so that this program when run on any work computer connects to the server and is able to retrieve information?
I have had a look around an it seems that for every computer on the network I have to create login details, so that the connection string contains the SPII value, or is it possible to create one login on the server that i can pass in the connection string and that allows it to connect?
Sorry my questions a bit rough, because I am trying to work out how that would work.
Thanks

Dani AI

Generated

A short practical guide that fills gaps in the thread: there are two common approaches to let the same program running on many workstations connect to one SQL Server — a shared SQL Server login (SQL Authentication) or Windows Integrated Authentication (domain accounts or a service account). and touched the shared-login idea; the important tradeoffs are security and configuration effort.

Server-side checklist (what must be done regardless of choice)

  • Choose authentication mode: enable "SQL Server and Windows Authentication" only if SQL Authentication will be used; otherwise prefer Integrated Security.
  • Create a dedicated login (or a domain/service account) and map it to a database user with least privilege (avoid sysadmin; use only needed roles).
  • Ensure the server accepts remote connections: enable TCP/IP in SQL Server Configuration Manager and restart the service.
  • If the instance is named (eg. SQLEXPRESS) either run SQL Server Browser or configure a fixed TCP port and open it in the server firewall. Default port is 1433 for default instances.
  • Secure credentials: do not ship plaintext passwords inside the app. Use encrypted config sections, the OS credential store, or a service account so the app doesn’t embed secrets.

Example connection-string patterns

# SQL Authentication (shared account)
Server=DBSERVERNAME\INSTANCE,1433;Database=MyDb;User Id=app_user;Password=StrongSecret;

# Windows Integrated Authentication (recommended when on a domain)
Server=DBSERVERNAME;Database=MyDb;Integrated Security=SSPI;

Operational tips and quick troubleshooting

  • Use connection pooling (built into most DB clients); open late and close early (eg. using the language's "using" or try/finally pattern).
  • Test from a client with Management Studio or sqlcmd to isolate network vs credential problems.
  • For least risk, give the application a single low-privilege DB account or grant a domain group access and manage users there. Avoid embedding the sa or highly privileged accounts in distributed apps.

Recommended Answers

All 4 Replies

You are asking about database login ?

A single login will do.

Oh ok, so on an M$ SMS if i create a single account for logging onto database, then that single account is good enough to manage all the connections, from multiple computers running the program that needs to connect to the same databsae?

Yes.

using virtual database all network computers can access with same login and password

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.