Scroll Top

DSN Versus DSN Less Connection

This article describes two ways of connecting Microsoft Access and PHP:

Approach 1

Using DSN

A Data source Name is a name that the ODBC uses to get the drive and other information that are vital for accessing data.To create a DSN go to the control panel.Choose Administrative Tools and select ODBC.Select System DSN and Add.Select a database driver.click finish.Type a DSN name.

DSN stores information required to connect to database.

-> Database type

->server location

->username and password

-> Connection options

Advantages:

1)Data source names are easier to remember and quite handy to use.

2)we want a central repository to hold the collection of data sources we are bound to use a DSN.

Disadvantages:

1)When ADO attempts to connect to a database using a System DSN it must perform a lookup in the registry. This lookup slower performance when there are many concurrent connections.

2)With DSN method, you will have to maintain two sets of settings: the script and the DSN itself.

3)ODBC driver for MS Access causes instability on the server.

Approach 2

Without using DSN(DSN-less method)

On the other hand when using DSN-less method we do not have to create a system level DSN for connecting to the database.

All the connection details are included in the connection string in the script itself.

Advantages

1)Often it is difficult to register a DSN and its always better to connect to your databases directly.

2)Provides faster database access because it uses native OLE DB providers, while DSN connections make use of ODBC drivers.

3)For portability reasons, it would be better to use DSN-less method

Disadvantages

1)Global database changes require changes be pushed out to all Web site owners in order to maintain site functionality.

2) Database connection information can be stored in individual PHP files and any changes to it would have to be repeated throughout all the files.

Summary

Some people think that DSN-less is faster while other believe DSN is faster based on several other tests.But if you are using a small site that gets less hits a day then in that case you won’t see much difference between the System DSN and DSN-less connection.Both the methods are good as well as bad in their own respective ways.Its upto you to choose the one that suits your requirement.

Reference :Internet

Related Posts

Privacy Preferences
When you visit our website, it may store information through your browser from specific services, usually in form of cookies. Here you can change your privacy preferences. Please note that blocking some types of cookies may impact your experience on our website and the services we offer.