[GRASS5] Re: ODBC ready

Markus Neteler neteler at geog.uni-hannover.de
Thu May 25 04:43:41 EDT 2000


Hi Radim, hi all,

yesterday I could run the new ODBC driver successfully!
Many thank for your big job, Radim!

Notes for others, how I did (I am ODBC newbie..):

Tested on SuSe Linux6.4, PostgreSQL 6.5, unixODBC 1.8.8.
--------------------------------------------------
Start: Getting unixODBC: www.unixodbc.org

Compile:
--------
configure
 or: configure --enable-gui  # strange: on one machine I got the
                             # ODBCConfig, on another it wasn't generated
make
make install

-> Files will go to /usr/local/lib/

Instructions to set up ODBC:
file:/home/user/unixODBC-1.8.8/doc/AdministratorManual/odbcinst.html

---------------------------------------
Get it running with GRASS:

a) establish ODBC connection to PostgreSQL (Oracle, ...):

Use 
  ODBCConfig
add new system DSN: means: add a new System DSN for each
database within the PostgreSQL. Only admin can add System DSN.
To add user specific DSN, use "User DSN".

Check for a list of databases:
psql -l

Example:
Assume, we have an existing database "boden" with table "humus":
  Name: Boden
  Description:Bodendatabase
  Host: localhost
  Username: neteler
  Database: boden

Use 
DataManager
to watch the settings.

b) Start GRASS:

List of drivers:
db.drivers -f
You should see the odbc driver (otherwise edit /etc/dbmscap).

List of available databases:
db.databases -l

(Note: To easily import a DBase database into PostgreSQL, use 
       pg.in.dbf from Alex)

Look for databases selectable through ODBC:
db.databases -l

You can preset most parameters:
db.connect driver=odbc database=boden user=neteler
db.connect -p

Look for tables:
db.tables driver=odbc database=boden

Describe a selected table:
db.describe driver=odbc database=boden table=humus
db.describe driver=odbc database=boden table=boshp

Describe the existing columns in table:
db.columns driver=odbc database=boden table=humus
db.columns driver=odbc database=boden table=boshp


Select statement (db.select can read from stdin):
db.select driver=odbc database=boden
select * from humus where humus > 1
CTRL-D twice!
- outout is zero at all.
-> Radim: what about table selection? Don't we need to select
   the table as well? I'll check the TODO list...
Or did I misuse it?

Disconnect:
db.connect driver=odbc database=

Congratulations, Radim!

Best wishes

 Markus Neteler

---------------------------------------- 
If you want to unsubscribe from GRASS Development Team mailing list write to:
minordomo at geog.uni-hannover.de with
subject 'unsubscribe grass5'



More information about the grass-dev mailing list