What would be DSN?

Asked

Viewed 701 times

7

Whenever I see someone preparing some configuration for database, I see appearing the term DSN.

I see it happening in the parameters of PDO (class to connect to PHP Database).

Example:

$dsn = 'mysql:host=localhost; dbname=test';

$pdo = new PDO($dsn);

Is this term DSN a nomenclature used for databases? What does this term mean?

  • 3

    DSN Data Source Name

2 answers

12


DSN is Data Source Name, generally the term defines the settings (ip, user, resource name, port, protocol etc.) necessary for accessing a data source. In the case of the question, it is a database. Another example would be LDAP.

5

It is not a nomenclature, DSN is the English acronym for Data Source Name (Data Source Name, in Portuguese) that contains the information necessary to connect to the database. This information can be: the type and name of the database, the user, password, driver, directory, among other information that will be used for the connection.

In the documentation you find more explanations and example about it.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.