Database access (OMDB legacy)

OMDB is the OmniMark database interface library, a set of functions that let you access and manipulate information in relational databases. This library uses either your existing ODBC-compliant database software drivers or Oracle 11g (or higher) client installation.

OMDB is designed to be as database vendor and database interface independent as possible. In a few places, OMDB's behavior is dependent on the database vendor or interface, and notes have been added to the documentation specifying the differences.

The library consists of the following files:

  • omdb.dll (Windows) or omdb.so (UNIX) -- the dynamic link library file that creates the required opaque data types and contains the functions used to manipulate those components.
  • omdb_odbc.dll (Windows) or omdb_odbc.so (UNIX) -- the dynamic link library that enables accessing databases using ODBC.
  • omdb_oci11g.dll (Windows) or omdb_oci11g.so (UNIX) -- the dynamic link library that enables accessing databases using OCI11g.
  • omdb.xin -- the OmniMark include file that contains the opaque data type definitions, the function declarations, and the required predefined variables.

Using the OMDB library is an introduction to the functions in the library, with sample code illustrating their use.

The OMDB functions and opaque data types

OMDB functions allow you to:

The functions in this library use the following data types:

  • dbDatabase -- used by functions performing actions on the database as a whole.
  • dbField -- used to retrieve a data value from a query.
  • dbTable -- used to modify the contents of a single table in the relational database.
  • dbStatement -- used to compile an SQL statement.
  • dbProcedure -- used to access a stored procedure in a database.

All dates, times, and timestamps are retrieved in the Date and Time library format. (This format returns the time with a time zone offset from UTC time.)

Requirements

To use the OMDB functions in your OmniMark program, you have to add the following statement to your program:

  include "omdb.xin"

Requirements - ODBC

If you are running OmniMark under UNIX and using ODBC to access databases, you must explicitly specify the location of your ODBC driver before you can use the OMDB library functions. Presuming your ODBC driver is installed in /usr/local/odbc:

  • If you use a Bourne shell, then issue these commands:
      LD_LIBRARY_PATH=/usr/local/odbc/lib:$LD_LIBRARY_PATH
      export LD_LIBRARY_PATH
    
  • If you use a C shell, then issue this command line:
      setenv LD_LIBRARY_PATH=/usr/local/odbc/lib:$LD_LIBRARY_PATH
    

Requirements - OCI

To make use of the OCI interface for accessing a database, you must have SQL*NET installed on your machine and configured to locate the database server(s) you wish to access. Oracle 11g client installations are supported.

OMDB Generated Exceptions

This is a complete list of the OMDB library external exceptions that may be thrown back to the calling OmniMark program. These are all catchable using the #external-exception label.

  OMDB001  Failed to allocate memory
  OMDB002 The database does not support the requested operation
  OMDB101  dbDatabase is not currently open for statement execution
  OMDB103  The source dbDatabase has left the current scope and is no longer available
  OMDB104  The source dbDatabase has changed internal state
  OMDB105  The specified SQL statement has a zero length
  OMDB106  The specified transaction mode value is invalid
  OMDB107  The database does not support streaming LOB parameters.
  OMDB202  SQL query must return at least one column
  OMDB204  This database driver may only retrieve BLOB columns after all other columns.
           Reorder the columns in your query.
  OMDB205  The record set is not positioned on a valid row
  OMDB206  The database does not support the requested cursor movement
  OMDB207  The attempted field retrieval order requires an implicit refresh of the
           record set that is not supported by this database
  OMDB208  Absolute and relative cursor positions cannot both be specified
  OMDB209  The database has been closed since the query was executed
  OMDB210  An invalid value was specified for the cursor type
  OMDB302  dbField is not currently associated with a query
  OMDB303  The SQL operation associated with the dbField returns a single record
           that does not support cursor movement
  OMDB304  The dbField argument shelf contains no columns
  OMDB305  The dbField is not a streaming execution handle
  OMDB306  The dbField is a streaming execution handle
  OMDB307  An external output has already been created for the current parameter
  OMDB402  The requested stored procedure could not be found
  OMDB403  Unable to determine the parameter type in the procedure
  OMDB404  The number of parameters in the procedure exceeds OMDB's internal limit
  OMDB405  The dbProcedure item is not currently open for processing requests
  OMDB406  The input value exceeds the maximum length allowed by the procedure parameter
  OMDB407  The procedure has more input parameters than items on the input shelf
  OMDB408  The specified procedure name has a zero length
  OMDB409  All of the procedure parameter description arguments must be supplied
  OMDB410  All of the procedure parameter description shelves must contain
           the same number of items
  OMDB411  The item keys of the procedure parameter description shelves are
           inconsistent with each other
  OMDB412  The procedure parameter data size must not be less than zero
  OMDB413  The procedure has been re-executed, so previous data is no longer available
  OMDB501  A database error occurred
  OMDB601  dbTable is not currently open for processing
  OMDB603  The stream item key has no matching table column name
  OMDB604  The date/time stream shelf item must be in OmniMark date format
  OMDB605  The specified table name has a zero length
  OMDB606  The specified table record contains zero items
  OMDB607  The table record item has no key value
  OMDB701  dbStatement is not currently open for processing
  OMDB702  The compiled statement requires input values
  OMDB703  The shelf of input parameter values for the compiled statement has too few items
  OMDB704  The compiled statement is a query and requires a dbField shelf
           argument to receive the results
  OMDB705  The input stream length exceeds the maximum size allowed by the parameter
  OMDB706  The ODBC driver is unable to determine the data types of the parameters
           in the SQL statement. The shelf of parameter data types is required by
           dbStatementCompile using this ODBC driver.
  OMDB707  The shelf of input parameter data types values for the compiled
           statement has too few items
  OMDB708  An invalid value was specified for a parameter data type
  OMDB709  The number of parameters exceeds the database's limit
  OMDB710  A streaming execute operation is currently active on this statement
  OMDB711  This statement does not have an active streaming execute operation
  OMDB712  The data for this parameter has already been received
  OMDB999  An internal error was detected. Contact OmniMark Technologies.