I have 2 servers setup at the moment. One is a web server running Win Server 08 and the other is a database server running SQL Server 08 on Win Server 08.
Currently I have my site setup so that it can read/write to the database by using a connection string I created with the database name, server ip, db user and db pwd. The db user I have created has a 'public' role setup in the database (not db owner) and can just run exec stored procedures. My the connection string currently looks like this:
<add name="SiteDBConn" connectionString="Server=IPOfServer;Database=DBname;User ID=userhere;Password=passhere;"/>
While this is working perfectly for me, I would like to setup a database connection string that did not contain any username and password. On some of my other servers, where SQL server resides on the same server as the web files, I am able to use a trusted connection and use the built in 'Network Service' user on my database. This lets me run a connection string with no username and password like so:
<add name="SiteDBConn" connectionString="Server=localhost;Database=DBname;Trusted_Connection=Yes;"/>
Is there an easy way to achieve a connection to the database without hardcoding a username and password - like the above connection string - when using 2 different servers? Am I wasting my time going down this route seeing as how the database user I created has only exec permissions anyways?
Thanks for your thoughts on this.
But hereis the page for SQL Server connection strings. If it works, then it'll be there EditIt looks like you canconnect remotely. It's just not configured that way out of the box
The Set-RDDatabaseConnectionString cmdlet configures database connection settings for the database server used in a high availability environment with multiple Remote Desktop Connection Broker (RD Connection Broker) servers.
For an ODBC database connection, you use the ODBC driver for SQL Server. You need to specify the following: Server - is the SQL Server name. If it is an instance you need to specify the servername\instance name. You can use a period (.) for a local SQL Server. If you use a port, you need to specify the server name, a comma and the port.
This command sets the primary and secondary database connection strings for all the RD Connection Broker servers in a deployment after the connection to the database is lost. Connectivity can be lost if the password expires or if the database administrator changes the connection string.
You are not wasting your time. This is a very good practice. When you separate out IIS and SQL on separate machines, here are some options:
If the 2 servers are not in the same Windows domain, you cannot use trusted connection.
Also, the login must be created as a Windows authentication, you can't use a SQL authentication login with a trusted connection.
Otherwise, everything Tapori said.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With