Data Source Name

Data Source Name

In computing, a data source name (DSN, sometimes known as a database source name though data sources are not limited to databases) are data structures used to describe a connection to a data source. Most commonly used in reference to ODBC, DSNs may also be defined for JDBC and other data access mechanisms.

DSN attributes may include, but are not limited to:

  • name of the data source
  • directory of the data source
  • name of a driver which can access the data source
  • user ID for data access (if required)
  • user password for data access (if required)

The system administrator of a client machine creates a separate DSN for each relevant data source.

Standardizing DSNs offers a level of indirection that various applications (for example: Apache/PHP and IIS/ASP) can take advantage of in accessing shared data sources.

Contents

Types of data source name

Two kinds of DSN exist:

  • Machine DSNs - stored in collective configuration files (e.g., /etc/odbc.ini, ~/.odbc.ini) and/or system resources (e.g., Windows Registry HKLM\Software\ODBC\odbc.ini)
  • File DSNs - stored in the filesystem with one DSN per file

These are further broken down into

  • System DSNs - accessible by any and all processes and users of the system, stored in a centralized location (e.g., /etc/odbc.ini, /etc/odbc_file_dsns/<filename>)
  • User DSNs - accessible only by the user who created the DSN, stored in a user-specific location (e.g., ~/.odbc.ini, ~/odbc_file_dsns/<filename>)

Misuse of the term

The term DSN is sometimes mistakenly used in place of connection string. A connection string typically fully describes a data source, while a DSN typically relies on some external system resources and/or configuration files.

Example of use

Software (e.g., Crystal Reports, Microsoft Excel, PHP, Perl, Python, Ruby) users can submit CRUD (Create, Read, Update, Delete) queries to a data source by establishing a connection to the DSN.

ASP (VBScript) code to open a DSN connection might look like the following:

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

In PHP using the PEAR::DB package to open a connection without an external DSN (a "DSN-less connection", i.e., using a Connection String), the code might resemble the following:

require_once("DB.php");
//$dsn = "<driver>://<username>:<password>@<host>:<port>/<database>";
$dsn = "mysql://john:pass@localhost:port/my_db";
$db = DB::connect($dsn);

See also



Wikimedia Foundation. 2010.

Игры ⚽ Нужен реферат?

Look at other dictionaries:

  • Data Source Name — Der Data Source Name (DSN) ist eine Datenstruktur (ähnlich einer URL oder einem Dateipfad), welche bei Datenbankabstraktionsframeworks (Datenbankabstraktionsschicht) wie ODBC (Open Database Connectivity), JDBC oder ADOdb die Zugangsdaten… …   Deutsch Wikipedia

  • Database Source Name — A data source name (DSN) is a data structure that contains the information about a specific database that an Open Database Connectivity (ODBC) driver needs in order to connect to it. Included in the DSN, which resides either in the registry or as …   Wikipedia

  • Database Source Name — Der Data Source Name (DSN) ist eine Datenstruktur (ähnlich einer URL oder einem Dateipfad), welche bei Datenbankabstraktionsframeworks (Datenbankabstraktionsschicht) wie ODBC (Open Database Connectivity), JDBC oder ADOdb die Zugangsdaten… …   Deutsch Wikipedia

  • Data source — A data source is any of the following types of sources for (mostly) digitized data: a database in the Java software platform, datasource is a special name for the connection set up to a database from a server a computer file a data stream This… …   Wikipedia

  • Data virtualization — describes the process of abstracting disparate data sources (databases, applications, file repositories, websites, data services vendors, etc.) through a single data access layer (which may be any of several data access mechanisms). This… …   Wikipedia

  • Data mapping — Data transformation/Source transformation Concepts metadata · data mapping data transformation · model transf …   Wikipedia

  • Data Transmission Network — DTN, formerly known as Data Transmission Network, is a subscription based service for the delivery of real time weather, agricultural and commodity market information. Telvent DTN is the name of the service that is owned by its parent company… …   Wikipedia

  • Data Format Description Language — (DFDL, often pronounced daff o dil) is a modeling language from the Open Grid Forum for describing general text and binary data. A DFDL model or schema allows any text or binary data to be read (or parsed ) from its native format and to be… …   Wikipedia

  • Data compression — Source coding redirects here. For the term in computer programming, see Source code. In computer science and information theory, data compression, source coding or bit rate reduction is the process of encoding information using fewer bits than… …   Wikipedia

  • Data Vault Modeling — is a database modeling method that is designed to provide historical storage of data coming in from multiple operational systems. It is also a method of looking at historical data that, apart from the modeling aspect, deals with issues such as… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”