Tuesday, November 11, 2014

What Is the Difference between a System DSN, a User DSN, a File DSN, Universal Data Link (UDL), and DSN-less Connection?

Primary Software: LabVIEW Toolkits>>Database Connectivity Toolset
Primary Software Version: 1.0
Primary Software Fixed Version: N/A
Secondary Software: N/A

Problem: 
What is the difference between a System DSN, a User DSN, a File DSN, Universal Data Link (UDL), and DSN-less connection?

Solution: 
There are many different database drivers (or providers) and also many ways of connecting to them. The table below list the five most common ways in which you can interact with a database provider.

Connection MethodWho Can Access Them?Where Connection Information is Stored
File DSNAny user who has access to the FileIn a file format (*.dsn)
System DSNAny user on that systemSystem Registry
User DSNOnly for the user for which that data source was createdSystem Registry
UDL (Universal Data Link)Any user who has access to the FileIn a file format (*.udl)
DSN-lessAny one who has access to the database files (i.e. mdb,.xls)No static storage of connection information (passed as the connection string during runtime)

System DSNs
System DSNs work for anyone using that system. For example, no matter who logs onto the machine, system DSNs can be seen by all users, and they are stored in the Local Machine section of the Registry.

User DSNsUser DSNs work only for a specific user on a machine. Therefore, if someone other than the person who created the user DSN logs onto that machine, then the User DSN will not show up. This DSN is stored in the Current User section of the Registry.

File DSNs
File DSNs are not stored in the Registry but rather in a file. That means you can store these DSNs to disk or network and use them on any machine or any user that has access to it.

UDLsNational Instrument's Database Connectivity Toolkit uses OLE DB to communicate with the databases. If you use a DSN, then the commands must be translated from OLE DB to ODBC through the OLE DB Provider for ODBC. Therefore, it is more efficient, and recommended, to use UDLs as the method of connection with the toolkit if an OLE DB Provider is available for the Database.

DSN-less
DSN-less means that you don't use a DSN to store your connection information. Instead, you either prompt your user for it at run time (Query Analyzer is a good example) or store the equivalent information somewhere else such as the registry, an INI file, or even a table. If you truly need to provide a dynamic connection where the user will be connecting to a variety of different sources, DSN-less is definitely easier on the user. Many developers decide to use a DSN-less connection and just store the connection string in the registry, eliminating the need to make sure that a valid DSN for the application exists.

No comments :

Post a Comment