Visual Studio can create a variety of types of connection strings.
The long answer is, DSN ("Data Source Name", not "DNS" which is an acronym
for "Domain Name Server") is the name for a set of techniques for storing
database connection information on a local machine in common stores, whether
they be the system registry or files. The problem with it is that it is
local to a machine, and any application that depends on it is not going to
be portable to another host.
The dirty little secret is that database connection information is easily
stored in a connection string, which is what you must create when you
connect to a DSN, in order to connect to the DSN. Yes, the connection string
is shorter when using a DSN, but in all honesty, a connection string doesn't
have to be long in most cases, and since the string is stored in the
application, the application is portable, as long as the connection string
can connect to a database on the network.
Almost every database product can be connected to using a connection string,
and every database product has different connection string parameter
elements. Essentially, a connection string is simply a set of name=value
pairs, separated by semicolons. These name=value pairs define the various
parameter names and corresponding values needed to connect to a database.
Typically, at least in the case of database servers such as SQL Server, the
connection string contains the server name or IP address, the name of the
database on the server, and usually some security credentials, such as user
name and password, or some other security token that allows access to the
specific database on the server. However, again, it varies from one database
product to another.
The following web site has various connection strings for many popular types
of databases. You should easily be able to get what you need from their
resources:
http://www.connectionstrings.com/
Here are a couple of typical connection strings as displayed on that web
site, and some explanation about each one:
Provider=sqloledb;Data Source=myServerAddress;Initial
Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Note the semicolons that delimit the name=value pairs. The first
("Provider") indicates the type of software being used to connect to the
database, in this case SQL Ole DB (Object Linking and Embedding for
Databases). The second ("Data Source") indicates the name of the database
server. The third ("Initial Catalog") is the particular database name on
that server. The last two ("User Id" and "Password") should be
self-explanatory. They indicate the specific user and credentials used to
log into the database.
Provider=sqloledb;Data Source=myServerAddress;Initial
Catalog=myDataBase;Integrated Security=SSPI;
This one is similar, but uses a "Trusted Connection," which means that the
credentials of the user logged in to the client machine, or the account
under which the application making the connection is logged into, will be
passed to the database server using Windows Integrated Security, rather than
passing the specific user name and password.
--
HTH,
Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP