ConnectionString Without DSN

  • Thread starter Thread starter Ross Culver
  • Start date Start date
R

Ross Culver

This is, by all accounts, a stupid question:

I've always used a connection string like this:
Data Source=DSNNAME;Initial Catalog=databasename;Persist Security
Info=True;User ID=sa;Password=pwd

I don't want to have to go to every computer and create this DSN manually.
How should the connection string read if you want to connect directly to the
sql server without specifying or creating a DSN?

Ross
 
Stephany and Kevin,

Thanks for the response; however, I already tried using just the server name
and I get the error that the datasource was not found. That's why I keep
creating a DSN with the same name as the server.

Ross
 
That's why I directed you to www.connectionstrings.com. Connection strings
vary from one database provider to another, and according to the type of
connection being made, and guessing at the proper format will get you
nowhere. As I don't know anything about either what database you're using,
or what the connection properties should be, I directed you to a web site
that provides all sorts of Connection Strings for all sorts of situations.

Using a System DSN is really an "ancient" technique which creates an
additional external dependency on the DSN. Look up the proper Connection
String for your needs and use that.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
Kevin,

I left out one very important piece of information: I created the
connection in VS2K5 using the connection wizard using the .net framework
data provider for SQL2K5 (SQL Client); wherein you select the server by
name and never have to specify a DSN. And yet, it only works if I create a
DSN with the same name as the server.

Go figure.

Ross
 
Maybe you will have to break down and show us what you have tried that
doesn't work.
 
The Visual Studio 2005 Connection Wizard doesn't ask for a DSN. I don't know
what you're referring to. It asks for any number of Connection String
parameters. You can also just create your own Connection String.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP
 
Back
Top