Skip to content

RadBizCom

 
You are here:
An Introduction to ODBC. PDF Print E-mail
Written by Administrator   
Sunday, 17 February 2008

ODBC stands for Open DataBase Connectivity. It is a client side cross platform data communication standard developed by Microsoft and is used predominantly on the Windows platform, although I am aware of implementations for some Unix platforms as well. I will concentrate on the Windows systems here as this is by far the most common.

From the point of view of the system user/administrator, ODBC has three aspects:
· The ODBC driver
· The ODBC Administrator
· The ODBC Data Source (DSN)
I will go through each of these in turn.

        The ODBC driver
        An ODBC driver is a piece of software which knows how to communicate with a data provider. This can be a relational database, a spreadsheet, a text file or any other potential source of data. It provides a vendor independent way of communicating in a two way basis with the application by any ODBC aware client application. It is typically written by the software manufacturer and supplied with their host application. However, third party drivers do exist. From the systems perspective, the driver is a set of DLL files that call the ODBC DLLs. Some common drivers such as text files are supplied as part of the operating system. If the driver is required as part of a larger application, it will typically be installed as part of an application's client together with related utilities.
        The ODBC Administrator
        The ODBC Administrator is the control centre for ODBC data sources and drivers and lets you add, configure and delete data sources, view the installed drivers and ODBC key file information. Some systems have an icon for this in the Control panel but others don't and I don't know why. If you can't find an icon titled "ODBC Administrator" or "Data Sources", just choose Start -> Run, put the filename in the box then hit OK. It should be somewhere in the system path. The filenames are ODBCAD32.EXE for Win32 systems or ODBCADMN.EXE if you still have a Win3.x system or 16 bit applications.
        The ODBC Data Source (DSN)
        The data source is the focal point of ODBC. A data source is an instance of a driver with connection details to a particular source of data and other preferences related to that source, accessed via the "Configure" button on the ODBC Administrator. The only mandatory field common across all sources is a name for the list, everything else is specific to the driver you use and it may or may not be mandatory.

        Typically for a client/server RDBMS the details would include the server or domain it is hosted on, network protocol and the username and password to connect. If file based the details would include a path to the file either as a drive mapping or a UNC name and username/password.

        If you run the ODBC Administrator, you will find that there are three types of data source, each with their own tab:

        Entries in the User DSN tab are specific to your user profile. If you are on a network with roaming profiles enabled they will follow you around as you login to various computers. However, the full driver must be installed on each workstation for it to work.

        Entries in the System DSN tab are available to anybody who logs into that computer (provided that access rights permit).

        Entries in the File DSN tab can be shared and easily copied between systems giving an easy way to duplicate a connection, provided that the full drivers have been installed on each computer.

        Entries of different types can have the same name (although you can't have two of the same type with the same name). However, connection from an application to a data source it is done by name rather than name and type. If there are multiple connections with the same name, the User data source takes priority, then the System source, with the File coming last.

        Connection from within a program either has details stored in a ConnectString with your application code (such as MS Access), which will typically take the form of "DSN=MyDSN;UID=Alf;PWD=passw0rd;" or you will be requested for a username, data source and password when trying to connect.

        The above example will connect to the data source called MyDSN as user Alf with password passw0rd. Usernames and passwords can of course be omitted if the data source has them stored in its preferences, or you wish to override the stored names.

         Common ODBC client applications.
        All of the Microsoft Office applications can use ODBC data sources to get data. The Microsoft Query applet is also an ODBC client. Database reporting applications such as Crystal Reports use ODBC to retrieve data. So do database application programming tools such as Powerbuilder and 4D, and database design tools such as ERWin and PowerDesigner. Practically every single desktop database and spreadsheet application can use ODBC data sources for input, and many other applications can do so as well. It is a very widespread standard.

        Software Development using ODBC.
        A software developer wanting to allow their application to use ODBC as a client need not write code specific to their preferred data provider for what they want to, only write to the ODBC Application Programming Interface to allow it to use any data source, and then let the user choose a source.

        If you are developing a server side application that could be used as a data provider, you would need to write drivers that conform to the ODBC standard, available from the Microsoft Data web site shown above. 

 
< Prev   Next >
[+]
  • Narrow screen resolution
  • Wide screen resolution
  • Auto width resolution
  • Increase font size
  • Decrease font size
  • Default font size
  • default color
  • hot color
  • natural color
radbizcom