function
Library: Database access (OMDB)
Import : omdb.xmd |
Returns: a |
export external database function open-odbc value string dsn user value string user-name optional initial { "" } password value string password optional initial { "" }
Argument definitions
Use db.open-odbc
to create a connection to an ODBC-compliant database. The function returns an instance of type
db.database
.
dsn must:
OMDB501
is thrown.
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 a shelf of type db.database
(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 d set d 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 shelf.
import "omdb.xmd" prefixed by db. process local db.database d local db.field q variable set d to db.open-odbc "Collection1" user "Phred123" password "ecorde143" db.query d sql ('SELECT EmpName, EmpName, {fn ucase(EmpName)}, Salary FROM Employee') into q