|
|||||
|
||||||
Related Syntax | Related Concepts | Other Library Functions |
function |
db.open-odbc |
Library: Database access (OMDB)
Import: omdb.xmd |
Return type: dbDatabase Returns: A db.database object for the opened database connection. |
define external db.database function db.open-odbc value string dsn or define external db.database function db.open-odbc value string dsn user value string user-name password value string password
Argument definitions
Use db.open-odbc to create a connection to an ODBC-compliant database. The function returns a db.database OMX component.
dsn must:
User-name and password are optional with default values of an empty string. Check the requirements for access to the specified database.
You must have declared an OMX db.database variable (either global or local) to reuse a database connection in other OMDB functions.
This function will throw external exception OMDB501 if there are any ODBC driver errors. The exception will include any error numbers and descriptive text generated by the ODBC driver. Consult your driver documentation for further details on the error condition.
Create a connection to the ODBC compliant database named DatabaseDemo. No user-name or password is required to access this database. This connection can be reused in other OMDB functions.
import "omdb.xmd" prefixed by db. process local db.database my-database . . . set my-database to db.open-odbc "DatabaseDemo"
Create a record set from a query to an unopened ODBC compliant database named Collection1. A user-name and password are required to access this database. Note that you will be unable to reuse this connection in other OMDB functions as it has not been assigned to a variable. The connection will close automatically when it is out of scope.
import "omdb.xmd" prefixed by db. global db.field my-query variable initial-size 0 process db.query db.open-odbc "Collection1" user "Phred123" password "ecorde143" sql ( 'SELECT EmpName, EmpName, {fn ucase(EmpName)}, Salary ' || 'FROM Employee' ) into my-query
Copyright © Stilo International plc, 1988-2008.