Database Source Name

From Wikipedia, the free encyclopedia

Database Source Names, more commonly seen as the abbreviation, DSN, are data structures used to describe a connection to a database. This DSN will take the form of protocol: subprotocol: host: port: database so as to completely specify all parameters of the connection. The exact format of the DSN will vary depending on your programming language.

[edit] Example of use

Using a DSN to connect to a MySQL database through the Web, Web users can submit form entries to a MySQL database by establishing a connection to the MySQL database's DSN.

The advantage of a DSN is that applications can take advantage of any database, as long as DSN is supported (i.e. in Apache/PHP, IIS/ASP)

In ASP (VBScript), to open a DSN connection, the code is:

Dim DatabaseObject1
Set DatabaseObject1 = Server.CreateObject("ADODB.Connection")
DatabaseObject1.Open("DSN=DSNname;")