ODBC IN LIBERTY BASIC - advanced level
by Dennis McKinney
http://libertybelle.0catch.com


Home

Liberty BASIC News
Safe Registry and Ini File Alternative
Deleting and Renaming Disk Files
Segments and Flushing
Flat Toolbar with Toolips
Translating 32-bit VB API Calls
Event-Driven Programming Concepts
Spotlight on the Community!
ODBC in Liberty BASIC
Hex Viewer
Listing Files Recursively
Registering Hot Keys
Preventing more than 1 instance
Multi-Coloured Text Input Boxes
Images on Buttons and Statictext
Two Demos by David Conner

Editor's note: ODBC stands for Open Database Connectivity. Dennis McKinney has developed a method to access ODBC directly in Liberty BASIC, using API calls. No add-on DLLs are required. Following, find excerpts from Dennis's messages about ODBC from the Experienced User's forum [lbexp]. Attached to this newsletter, find a sample program file that illustrates the use of ODBC in Liberty BASIC. Used by permission.

**********************
The definition of ODCB, according to Microsoft:

Open Database Connectivity (ODBC) is a widely accepted application programming interface (API) for database access. It is based on the Call-Level Interface (CLI) specifications from X/Open and ISO/IEC for database APIs and uses Structured Query Language (SQL) as its database access language.
**********************

Excerpts from Dennis's messages on ODBC:

Liberty BASIC can: interface with Access/VB databases (*.mdb), create these databases, create and modify tables, create fields, assign keys and indexes, save records, retrieve recordsets, execute SQL statements. If this can be done with Access databases it can be done with any database that uses ODBC.

No [add-on] dll [is required] at this point. This is pure Liberty BASIC 3.1. All that's required is MDAC 2.1 or greater to be installed on your computer. These are the 32 bit drivers for ODBC. The Jet drivers are also needed. After a certain version they no longer ship with MDAC. I think it's around V2.6. Most Windows computers have these anyway. They're installed by a number of common programs that people use.

The information I've used to get the ODBC code started comes from the ODBC 3.0 SDK. This is hard to come by in book form but the entire book plus more is on the MSDN site. The start page is

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/dasdko/dbcoverview.asp

The book is listed on this page's menu as ODBC Programmers Reference and the ODBC API is listed there also.

Info specific to Access can be found at

http://msdn.microsoft.com/library/en-us/odbc/htm/odbcjetmicrosoft_access_driver_/programming_considerations.asp

A lot of good info can be found by searching the web too.

ODBC is just a batch of API calls mixed with SQL. It's purpose is to allow Windows apps to access data from a variety of databases. This includes mysql databases. My code focuses on Access and VB because that is what I have, and those drivers exist on the majority of Windows computers. The main difference between using ODBC with Access verses other databases is mostly in the SQL syntax used, so the code should be fairly easy to adapt when other databases like mysql are targeted.

There is an excellent online book to learn SQL at

http://members.tripod.com/er4ebus/sql/

At this time the code I have is just a set of functions to handle the basic tasks of ODBC. It's very basic and needs a lot of development. As soon as I can get a simple gui put together for it I'll put it in the files section here at lbexp. If you're like me, a working example goes a long way when trying to learn something new. Just as a test, I ran the code in a Win98 computer that has never has Access or VB installed and the code worked. The database was created, etc.

*******
Editor's note: the sample Dennis speaks of is attached to this newsletter.


Home

Liberty BASIC News
Safe Registry and Ini File Alternative
Deleting and Renaming Disk Files
Segments and Flushing
Flat Toolbar with Toolips
Translating 32-bit VB API Calls
Event-Driven Programming Concepts
Spotlight on the Community!
ODBC in Liberty BASIC
Hex Viewer
Listing Files Recursively
Registering Hot Keys
Preventing more than 1 instance
Multi-Coloured Text Input Boxes
Images on Buttons and Statictext
Two Demos by David Conner