Jump to:  OMake Home • Guide Home • Guide (single-page) • Contents (short) • Contents (long)
Index:  All • Variables • Functions • Objects • Targets • Options

Chapter 20  The ODBC binding

ODBC stands for “Open Database Connectivity.” It is standard, developed by http://www.microsoft.com, for generic database access. There are versions for most popular operating systems, including Mac OS X and GNU/Linux.

ODBC itself is documented by Microsoft ODBC Function Summary, and information abounds. The Wikipedia ODBC page is another good starting point.

The OMake ODBC port is actually modeled on JDBC (JDBC Tutorial, java.sql), but the underlying access is still ODBC. We document part of the interface here.

Generally speaking, a JDBC-style database has several components.

20.1  ODBC objects

20.1.1  Odbc::DriverManager

Methods:

20.1.2  Obdc::Connection

Methods:

20.1.3  Odbc::Statement

Methods:

20.1.4  Odbc::PreparedStatement

Methods:

20.1.5  Odbc::Rowset

A Rowset is the result of a query.

Methods. Most methods return true on success, false on failure.

20.2  A small example

The following trivial example fetches the title and subtitle of all recorded programs in a MythTV database.

open odbc

conn = $(DriverManager.getConnection mythtv, user = mythtv, passwd = mythtv)
stmt = $(conn.createStatement)
rs = $(stmt.executeQuery $'SELECT title, subtitle FROM recorded;')
while $(rs.next)
    title = $(rs.get title)
    subtitle = $(rs.get subtitle)
    println($"title = $(title); subtitle = $(subtitle)")
Jump to:  OMake Home • Guide Home • Guide (single-page) • Contents (short) • Contents (long)
Index:  All • Variables • Functions • Objects • Targets • Options