SQL Remote C#

  • Thread starter Thread starter Luke Davis
  • Start date Start date
L

Luke Davis

What do I have to change in the connection string to connect remotely to a
SQL 2005 Server?

(i.e. \\SQLSERVER becomes http://sqlserver.com:1433/)

I am outsourcing the hosting and there is some information that references
an internal database, any suggestions on the best way to make this happen?

Thanks

Luke Davis
 
a typical remote machine SQL Server connection string would look like:

server=sqlserver.com;database=mydatabase;uid=user;pwd=pass;

You would normally expect the SQL server to use TCP connections, no port is
necessary unless it is specified as nonstandard. This is using the SqlClient
class
for access.

You can visit connectionstrings.com for more.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com
 
What about an instance of SQL? sqlserver.com\SQLEXPRESS?

--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com
 
Alright NEW PROBLEM!

I figured out it was still just the domain, I guess the instance does not
have to be requested, strange. But anywho, I'm getting this message now:
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.

Any ideas of what I have to add to my database of accessible users to get a
remote IIS server to connect?
 
I figured out it was still just the domain, I guess the instance does not
have to be requested, strange. But anywho, I'm getting this message now:
Login failed for user ''. The user is not associated with a trusted SQL
Server connection.

Any ideas of what I have to add to my database of accessible users to get
a remote IIS server to connect?

What connection string are you using...? Are the userid and password
valid...?
 
You probably need to specify a username and password for the connection. The
reason is, otherwise you're using a trusted connection which basically means
the connection you are making comes under the account that the code is
running under. This could be one of several accounts depending upon the web
server. Those accounts must be given writes within SQL Server to login. I
don't like this approach as it's easy to give something like the ASPNet user
account way too much access to your database. The best resource for
connection strings is: http://www.connectionstrings.com/ Has pretty much
everything you'd want to know about connecting to a datasource in just about
any environment.
 
Back
Top