2

Is it possible to connect to a SQL Server database with GRASS?

I tried this way:

>db.connect driver=ODBC database='dbname=mydb,host=myserv'
(Mon Dec 12 15:34:27 2016) Completed (0 sec)`

But next, when I try to show a list of tables:

>db.tables
-p                                                                    
ERROR: Unable to open database <dbname=mydb,host=myserv>

The database is hosted on a server on my local network and I use GRASS 7.0.5 and SQL Server 12

1

Your connection string probably is wrong (has comma instead of semicolon). Try using something like

db.connect driver=ODBC database='dbname=mydb;host=myserv'

and then use

db.login

As suggested in the docs: https://grass.osgeo.org/grass64/manuals/db.connect.html

Or try experimenting with ODBC connection strings: https://www.connectionstrings.com/sql-server-native-client-11-0-odbc-driver/ .

Also, it may be you need a DSN for ODBC access, the docs mention it: https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_7_0/db/drivers/odbc/grass-odbc.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.