Skip to main content
Version: 10.1

USoft for ODBC

USoft for ODBC is a normal USoft application that connects to an (R)DBMS to retrieve and store data. The connection is made via an ODBC Driver. This can be useful when you wish to work with an RDBMS other than those directly supported by USoft. A requirement is that there must be an ODBC driver for this external (R)DBMS and that ODBC driver must support at least the requirements listed in the following section.

USoft for ODBC could be particularly useful in combination with a lightweight stand-alone RDBMS (for example, Sybase SQLAnywhere) on a notebook or laptop computer for demonstrations, presentations, on-site development, and so on.

ODBC driver requirements

A USoft for ODBC application requires an ODBC driver and a DBMS to access data. There are many ODBC drivers available on the market. Not all ODBC drivers can be used with USoft. This section details the minimum ODBC driver functionality required by a USoft ODBC application.

A USoft ODBC application does not check all the requirements listed in this section every time at start-up. Instead it just activates the ODBC functions and sends SQL-statements to the driver at run-time.

If the connected ODBC driver is not capable of executing the request it will return an error. USoft will retrieve the error message, show it to the user and cancel the requested action. This way it is possible to use an USoft ODBC application in combination with an ODBC driver that does not support the complete SQL syntax and all SQL data types and scalar functions. Development or deployment can be severely hindered, or even become impossible, when too many of the requirements are not met.As a work around, you might need to change the application by changing or removing the error-producing SQL or data type definitions. Whenever possible use an ODBC driver that does support at least all the requirements.

ODBC conformance

ODBC drivers conform to certain conformance levels. There are conformance levels for ODBC functions (API) and SQL grammar. USoft Production for ODBC requires the following minimum conformance levels from the ODBC driver.

SQL_ODBC_API_CONFORMANCE must be set to a non-negative value (zero or higher).

SQL_ODBC_SQL_CONFORMANCE must be set to 1 or higher than 1.

The ODBC driver MUST support transaction processing (Commit and Rollback) and transaction isolation level: SQL_TXN_REPEATABLE_READ or higher (SQL_TXN_SERIALIZABLE or SQL_TXN_VERSIONING).

The ODBC driver must be capable of having two or more connections active: SQL_ACTIVE_CONNECTIONS must be set to 2 or higher. It must be set to 3 or higher when creating application tables from within USoft Developer).

The ODBC driver must be capable of having two or more active statements per connection: SQL_ACTIVE_STATEMENTS must be set to 2 or higher. MS SQL Server via ODBC reports 1 active statement, but still functions correctly with USoft Developer.

ODBC functions

The ODBC programming interface consists of functions that come in two categories:

  • Core functions
  • Extended functions (level 1, and level 2)

ODBC functions supported and unsupported by USoft are listed in the following tables, grouped by task.

Connecting to a data source

FunctionLevelSupported?Purpose
SQLAllocEnvCoreYesObtains an environment handle. One handle is used for one or more connections.
SQLAllocConnectCoreYesObtains a connection handle.
SQLBrowseConnect2No
SQLConnectCoreYesConnects to a specific driver by data source name, user ID, and password. One connection is used for one or more statements.
SQLDriverConnect1YesConnects to a specific driver by connection string or requests that the Driver Manager and driver display connection dialogs for the user.

Obtaining information about driver and data source

FunctionLevelSupported?Purpose
SQLGetfunctions1YesReturns information about a specific driver and data source.
SQLGetInfo1Yes

Returns supported driver functions. This function also returns supported scalar functions for the infotypes:

- SQL_numeric_functions
- SQL_string_functions
- SQL_system_functions
- SQL_timedate_functions
- SQL_convert_functions.

SQLGetTypeInfo1YesReturns information about supported data types.

Setting and retrieving driver options

FunctionLevelSupported?Purpose
SQLGetConnectOption1YesReturns the value of a connection option.
SQLGetStmtOption1YesReturns the value of a statement option.
SQLSetConnectOption1YesSets a connection option.
SQLSetStmtOption1YesSets a statement option.

Preparing SQL requests

FunctionLevelSupported?Purpose
SQAllocStmtCoreYesAllocates a statement handle.
SQLPrepare1YesPrepares a SQL statement for later execution.
SQLBindParameter1YesAssigns storage for a parameter in a SQL statement.
SQLParamOptions2YesSpecifies the use of multiple values for parameters.
SQLGetCursorNameCoreYesReturns the cursor name that is associated with a statement handle.
SQLSetCursorNameCoreYesSpecifies a cursor name.
SQLSetScrollOptions2No

Submitting requests

FunctionLevelSupported?Purpose
SQLExecuteCoreYesExecutes a prepared statement.
SQLExecDirectCoreYesExecutes a statement.
SQLNativeSql2YesReturns the text of a SQL statement as translated by the driver.
SQLDescribeParam2No
SQLNumParams2YesReturns the number of parameters in a statement.
SQLParamData1No
SQLPutData1No

Retrieving results and information about results

FunctionLevelSupported?Purpose
SQLRowCountCoreYesReturns the number of rows affected by an insert, update, or delete request.
SQLNumResultsColsCoreYesReturns the number of columns in the result set.
SQLDescribeColCoreYesDescribes a column in the result set.
SQLColAttributesCoreYesDescribes attributes of a column in the result set.
SQLBindColCoreYesAssigns storage for a result column and specifies the data type.
SQLFetchCoreYesReturns a result row.
SQLExtendedFetch2YesReturns multiple result rows.
SQLGetData1YesReturns part or all of one column of one row of a result set. (Useful for long data values.)
SQLSetPos2No
SQLMoreResults2YesDetermines whether there are more result sets available and, if so, initialises processing for the next result set.
SQLErrorCoreYesReturns additional error or status information.

Obtaining information about the data source's system tables (catalog functions)

FunctionLevelSupported?Purpose
SQLColumns1YesReturns the list of columns in specified table(s).
SQLColumnPrivileges2No
SQLForeignKeys2No
SQLPrimaryKeys2YesReturns the list of column names that make up the primary key for the specified table.
SQLProcedureColumns2No
SQLProcedures2No
SQLSpecialColumns1YesReturns information about the optimal set of columns that uniquely identifies a row in a specified table, or the columns that are automatically updated when any value in the row is updated by a transaction.
SQLStatistics1YesReturns statistics about a single specified table and the list of indexes associated with the table.
SQLTablePrivileges2No
SQLTables1YesReturns the list of table names stored in a specific data source.

Terminating a statement

FunctionLevelSupported?Purpose
SQLFreeStmtCoreYesEnds statement processing and closes the associated cursor, discards pending results, and, optionally, frees all resources associated with the statement handle.
SQLCancelCoreYesCalls the SQLFreeStmt function.
SQLTransactCoreYesCommits or rolls back a transaction.

Terminating a connection

FunctionLevelSupported?Purpose
SQLDisconnectCoreYesCloses a connection.
SQLFreeConnectCoreYesReleases the connection handle.
SQLFreeEnvCoreYesReleases the environment handle.

Supported SQL

An external program that accesses the database of a USoft business application must define its data needs in standard SQL. The SQL statements that can be used are:

  • SELECT
  • INSERT
  • UPDATE
  • DELETE
  • INVOKE

Data definition statements such as CREATE, ALTER, and DROP are not supported. Use the USoft Developer's Create Application Tables function instead.

The authorisation statements GRANT and REVOKE are not supported.