ODBC

NAME
SYNOPSIS
DESCRIPTION
OPTIONS
EXAMPLE
SEE ALSO
AUTHOR
BUGS

NAME

odbc - provide ODBC-based database access

SYNOPSIS

odbc [-v] [-R RS] [-F FS] [-h] [-n null] DRVC stmt

DESCRIPTION

Odbc prints the results of an SQL select command run on any database for which an appropriate data source has been defined. Two arguments must always be specified as part of the odbc invocation: the data source driver connection string, and an SQL select statement. All data types are currently output as text according to the default driver-supplied data conversions. By default fields are separated by the tab character and records by a newline. The select statement specified must conform to the syntax and conventions used by the database being accessed.

The driver connection string can either specify a registered system data source driver name, as in:
"DSN=registered_dsn_name;uid=myusername;pwd=mypassword"
or directly a driver, as in:
"Driver={Microsoft Access Driver (*.mdb)};DBQ=c:\db\myfile.mdb"
Data source drivers are typically configured through the control panel (ODBC category or through the Administrative Tools menu).

OPTIONS

-R RS

Specify the record separator used to delimit records on output. The default record separator is a newline.

-F FS

Specify the field separator used to delimit fields on output. The default field separator is a tab.

-h

The first line of the output will contain the name of each database field.

-n null

Specify the value to print when encountering a null value. By default nothing is printed.

EXAMPLE

mail ‘odbc DSN=userDB "select email from users"‘ <message
Extracts the email address from all records from the table users which is part of the database userDB and sends them the file message by email.

SEE ALSO

D. Spinellis. Outwit: Unix tool-based programming meets the Windows world. In USENIX 2000 Technical Conference Proceedings, San Diego, CA, USA, June 2000, USENIX Association.
International Organization for Standardization, Geneva, Switzerland. Information technology — Database languages — SQL — Part 3: Call-Level Interface (SQL/CLI), 1995. ISO/IEC 9075-3:1995.
Microsoft Developer Network Library, ODBC API Reference, the ‘Comments’ section of the SQLDriverConnect function.

AUTHOR

(C) Copyright 1999-2003 Diomidis Spinellis. All rights reserved.

Permission to use, copy, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation.

THIS SOFTWARE IS PROVIDED ‘‘AS IS’’ AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

BUGS

The presentation of results in textual format depends on the implementation of the ODBC driver.