|Prev||Chapter 46. ODBC Interface||Next|
The ODBC API matches up on the backend to an ODBC compatible data source. This could be anything from a text file to an Oracle RDBMS.
The backend access come from ODBC drivers, or vendor specifc drivers that allow data access. PostODBC is such a driver, along with others that are available, such as the OpenLink ODBC drivers.
Once you write an ODBC application, you SHOULD be able to connect to ANY back end database, regardless of the vendor, as long as the database schema is the same.
For example. you could have MS SQL Server and PostgreSQL servers which have exactly the same data. Using ODBC, your Windows app would make exactly the same calls and the back end data source would look the same (to the windows app).
In the real world, differences in drivers and the level of ODBC support lessens the potential of ODBC:
|Access, Delphi, and Visual Basic all support ODBC directly.|
|Under C++, such as Visual C++, you can use the C++ ODBC API.|
|In Visual C++, you can use the CRecordSet class, which wraps the ODBC API set within and MFC 4.2 class. This is the easiest route if you are doing Windows C++ development under Windows NT.|
If I write an app for PostgreSQL can I write it using ODBC calls to the PostgreSQL server, or is that only when another database program like MS SQL Server or Access needs to access the data?
Again, the ODBC API set is the way to go. You can find out more at Microsoft's web site or in your Visual C++ docs (if that's what you are using.)
Visual Basic and the other RAD tools have Recordset objects that use ODBC directly to access data. Using the data-aware controls, you can quickly link to the ODBC back end database (very quickly).
Playing around with MS Access will help you sort this out. Try using File->Get External Data
TIP: You'll have to set up a DSN first.
TIP: The PostgreSQL datetime type will break MS Access.
|ODBC Interface||Up||JDBC Interface|
If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.