Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

grass-odbc(1grass) [debian man page]

grass-odbc(1grass)						Grass User's Manual						grass-odbc(1grass)

NAME
grass-odbc - ODBC driver ODBC driver ODBC driver in GRASS Communication between GRASS and ODBC database for attribute management: | GRASS module | | ODBC Interface | | RDBMS | GRASS | DBMI driver | unixODBC | ODBC driver | PostgreSQL | Oracle | ... Supported SQL commands All SQL commands supported by ODBC. Operators available in conditions All SQL operators supported by ODBC. EXAMPLE
In this example we copy the dbf file of a SHAPE map into ODBC, then connect GRASS to the ODBC DBMS. Usually the table will be already present in the DBMS. Configure ODBC driver for selected database (manually or with 'ODBCConfig'). ODBC drivers are defined in /etc/odbcinst.ini. Here is example: [PostgreSQL] Description = ODBC for PostgreSQL Driver = /usr/lib/libodbcpsql.so Setup = /usr/lib/libodbcpsqlS.so FileUsage = 1 Create DSN (data source name). The DSN is used as database name in db.* modules. Then DSN must be defined in $HOME/.odbc.ini (for this user only) or in /etc/odbc.ini for (for all users) [watch out for the database name which appears twice and also for the PostgreSQL protocol version]. Omit blanks at the beginning of lines: [grass6test] Description = PostgreSQL Driver = PostgreSQL Trace = No TraceFile = Database = grass6test Servername = localhost UserName = neteler Password = Port = 5432 Protocol = 8.0 ReadOnly = No RowVersioning = No ShowSystemTables = No ShowOidColumn = No FakeOidIndex = No ConnSettings = Configuration of an DSN without GUI is described on http://www.unixodbc.org/odbcinst.html, but odbc.ini and .odbc.ini may be created by the 'ODBCConfig' tool. You can easily view your DSN structure by 'DataManager'. Con- figuration with GUI is described on http://www.unixodbc.org/doc/UserManual/ To find out about your PostgreSQL protocol, run: psql -V Now create a new database if not yet existing: db.createdb driver=odbc database=grass6test Now store the table 'mytable.dbf' (here: in current directory) into PostgreSQL through ODBC: db.connect driver=odbc database=grass6test db.copy from_driver=dbf from_database=./ from_table=mytable to_driver=odbc to_database=grass6test to_table=mytable Next link map to attribute table (now the ODBC table is used, not the dbf file): v.db.connect map=mytable.shp table=mytable key=ID database=grass6test driver=odbc v.db.connect -p Finally a test: Here we should see the table columns (if the ODBC connection works): db.tables -p db.columns table=mytable Now the table name 'mytable' should appear. Doesn't work? Check with 'isql ' if the ODBC-PostgreSQL connection is really established. Note that you can also connect mySQL, Oracle etc. through ODBC to GRASS. You can also check the vector map itself concerning a current link to a table: v.db.connect -p mytable.shp which should print the database connection through ODBC to the defined RDBMS. SEE ALSO
db.connect, v.db.connect, unixODBC web site, SQL support in GRASS GIS Last changed: $Date: 2011-02-07 18:59:50 +0100 (Mon, 07 Feb 2011) $ Help Index GRASS 6.4.2 grass-odbc(1grass)

Check Out this Related Man Page

iodbctest(1)						       iODBC Driver Manager						      iodbctest(1)

NAME
iodbctest, iodbctestw - iODBC Demonstration programs SYNOPSIS
iodbctest ["DSN=xxxx[;UID=xxxx][;PWD=xxxx][;OPT=value]"] iodbctestw ["DSN=xxxx[;UID=xxxx][;PWD=xxxx][;OPT=value]"] DESCRIPTION
The iodbctest program and iodbtestw programs are simple ODBC sample programs, showing the strength of the ODBC API to connect to any ODBC enabled database, issue SQL commands and retrieve the query results. The iodbctest program uses the standard ODBC API calls to connect using any DSN, but retrieves all results in ASCII mode. The iodbctestw program uses the ODBC Unicode API calls to connect using any DSN, and retrieves all results in Unicode mode. OPTIONS
The iodbctest program uses the SQLDriverConnect function to make a connection using any available ODBC compliant driver. This allows the user to override any ODBC connect attribute in the DSN string. Connect strings should start with either a DSN=xxx or a DRIVER=xxxx attribute optionally followed by other DSN attributes separated by a semicolon e.g: DSN=ora9;UID=scott;PWD=tiger;DATABASE=ora9u Any attributes required for a proper connection that are not entered in the DSN connect string, must be present in the odbc.ini file. If the connect string is passed as an argument to the iodbctest program, the string should be quoted as most shells use the semicolon as their command separator. If the connect string is entered on the interactive prompt, no quotes should be used. After a successful connection has been established, the user is prompted for a SQL command to be send to the database. A SQL command cannot span multiple lines. If the SQL command returns one or more result sets, each result set is fetched using character buffers and displayed in a table. Additionally, the iodbctest program understands a few special commands: qualifiers Show a list of qualifiers using the SQLTables catalog call. owners Show a list of owners using the SQLTables catalog call. tables Show a list of tables using the SQLTables catalog call. types Show a list of tables types using the SQLTables catalog call. datatypes Show a list of data types using the SQLGetTypeInfo catalog call. reconnect Perform a disconnect/reconnect with the information saved during the first SQLDriverConnect. quit (or exit) Exit the program and return to the shell. EXAMPLES
Start the iodbctest program and get a list of DSNs before making a connection: $ iodbctest OpenLink ODBC Demonstration program This program shows an interactive SQL processor Enter ODBC connect string (? shows list): ? DSN | Driver ----------------------------------------------------------------- ora9 | OpenLink Generic ODBC Driver mysql | OpenLink Generic ODBC Driver mysqllite | OpenLink Lite for MySQL myodbc | MyODBC Driver pgsql | OpenLink Generic ODBC Driver tds | OpenLink Generic ODBC Driver Enter ODBC connect string (? shows list): DSN=ora9;PWD=tiger Driver: 05.20.0316 OpenLink Generic ODBC Driver (oplodbc.so) SQL> Connect to an Oracle 9 instance which has been previously setup in the odbc.ini file: $ iodbctest "DSN=ora9;UID=scott;PWD=tiger" iODBC Demonstration program This program shows an interactive SQL processor Driver: 05.20.0316 OpenLink Generic ODBC Driver (oplodbc.so) SQL>select * from emp ID |NAME -----------------+------------------------------------------- 1 |Record 1 2 |Record 2 2 |Record 3 result set 1 returned 3 rows. SQL> quit COPYRIGHT
Copyright (C) 1996-2009 by OpenLink Software AUTHOR
iODBC Administrator <iodbc@openlinksw.com> 3.52.7 3 August 2005 iodbctest(1)
Man Page