What is DSN and DSN-less Connection ?

DSN or DSN-less?
Connection to your database can be done using either a DSN (Data Source Name) or without DSN aka DSN-less.

DSN stores all the information required to connect to your database, including your database type, server / file location, username and password as well as connection options is stored in the DSN itself. Your script simply refers to the connection using the DSN name.

On the contrary, when using DSN-less method, your script would have to specify all the above details in the connection string itself.

Should you use DSN or DSN-less method?
Some people tend to think that DSN-less is faster because it saves the time to look up the DSN information in the registry. Some people think DSN is faster based on several tests.The main consideration really is this :

 With DSN method, you will have to maintain two sets of settings: your script and the DSN itself. With DSN-less method, all you need to maintain is the script / connection string.

 For portability reasons, it would be better to use DSN-less method. However depending on your circumstances, DSN method might be more appropriate / convenient.

Was this answer helpful?

 Print this Article

Also Read

Can you provide me with some OleDB connection string examples?

  MS Access (Jet) "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA Source=[Path to database];User...