[GRASSLIST:9598] Re: Using unixODBC to connect GRASS to MySQL

William Kyngesburye woklist at kyngchaos.com
Wed Dec 21 18:01:12 EST 2005


I believe the MySQL ODBC connector binary is meant for iODBC as  
provided by Apple in the system.  GRASS uses UnixODBC.

GRASS can be made to use iODBC instead - I think the ODBC API is  
standard.  I have built GRASS with iODBC instead of UnixODBC, but  
haven't tested it yet.  I have an installer that you can try (it  
would be nice to get some testing to see if this works):

<http://www.kyngchaos.com/macosx/files/grass-6.1cvs.pkg.zip>

This requires my Graphics Libs and GIS Libs installers from my site.   
It's the CVS from mid-November, I think.  It's sortof in preparation  
to releasing my own Mac OS X binaries - it's lacking a proper readme  
and license file.

If you want to try building grass yourself with iODBC (unless you're  
using Lorenzo's binaries), try this: in configure change every  
instance of -lodbc to -liodbc (use case sensitive, whole words to  
avoid possibly damaging something else).  GRASS configure will now  
find iodbc and build that in.


To configure iODBC for the MySQL connector, see the readme that comes  
with the MySQL connector - you use /Applications/Utilities/ODBC  
Administrator.app.  I haven't really gotten very far with this, so I  
can't help with the gorey details.


On Dec 21, 2005, at 3:53 PM, Nila Kreidich wrote:

> Hello,
>
> I am currently using Mac OS X 10.4.3 and GRASS 6.1.cvs.  After  
> having major problems using the MySQL driver in GRASS I have  
> decided to try using unixODBC to connect GRASS to MySQL.  However,  
> I can not figure out how to call the DSN using db.connect and  
> db.login.  In short this is what I have been able to do:
>
>
> 1. Downloaded the MySQL Connector/ODBC 3.51.12 for OS X
>       http://dev.mysql.com/downloads/connector/odbc/3.51.html
>
> 2. Used this web link to figure out how to configure a myodbc dsn  
> on Unix
>
>      http://dev.mysql.com/doc/refman/5.0/en/dsn-on-unix.html
>
> [I am not sure if I configured the myodbc DSN correctly.  I am  
> still not sure how to correctly manipulate the odbc.ini.]
>
> 3.  I then went to the X11 terminal to change the database settings  
> in GRASS and set them to use odbc driver.
>
> db.login driver=odbc database="host=localhost,dbname=GRASS2"  
> user=root password="
>
>  db.connect driver=odbc database=GRASS2 username=root
>  Sorry, <username> is not a valid parameter
>
> GRASS 6.1.cvs (san_joaquin2):~ > db.tables -p
> DBMI-ODBC driver error: SQLConnect():
> [unixODBC][Driver Manager]Data source name not found, and no  
> default driver specified (0)
>
> or I get this error
>
> GRASS 6.1.cvs (san_joaquin2):~ > db.tables -p
> DBMI-MYSQL driver error: mysql_real_connect() error (1044): Access  
> denied for user ''@'localhost' to database 'grass2'
>
>
> I am not calling the DSN correctly.  Any suggestions!!!
>
> Thank you,
>
> Nila Kreidich
>
> Graduate Student Researcher
> UC Davis Department of Hydrology
>
>

-----
William Kyngesburye <kyngchaos at kyngchaos.com>
http://www.kyngchaos.com/

Theory of the Universe

There is a theory which states that if ever anyone discovers exactly  
what the universe is for and why it is here, it will instantly  
disappear and be replaced by something even more bizarrely  
inexplicable.  There is another theory which states that this has  
already happened.

-Hitchhiker's Guide to the Galaxy 2nd season intro




More information about the grass-user mailing list