IBM Books

Net.Data Language Environment Reference


ODBC Language Environment

The Open Database Connectivity (ODBC) language environment executes SQL statements through an ODBC interface. ODBC is based on the X/Open SQL CAE specification, which lets a single application access many database management systems.

To use the ODBC language environment, you must have an ODBC driver and a driver manager. Your ODBC driver documentation describes how to install and configure your ODBC environment.

Sending SQL statements in an ODBC environment is similar to other Net.Data functions. The following example is a Net.Data macro that sends multiple SQL statements to the database that is your ODBC data source. Operating systems that use the DATABASE variable must specify the same database as the data source in the ODBC.INI file.

%DEFINE {
   DATABASE="qesq1"
   SHOWSQL="YES"
   table="int_null"
   LOGIN="netdata1"
   PASSWORD="ibmdb2"
%}
 
%function(dtw_odbc) sq1() {
create table int_null (int1 int, int2 int)
%}
 
%function(dtw_odbc) sql2() {
insert into $(table) (int1) values (111)
%}
 
%function(dtw_odbc) sql3() {
insert into $(table) (int2) values (222)
%}
 
%function(dtw_odbc) sql4() {
select * from $(table)
%}
 
%function(dtw_odbc) sql5() {
drop table $(table)
%}
 
%HTML(REPORT) {
@sql1()
@sql2()
@sql3()
@sql4()
%}


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]