What is the correct connection string for clsql when accessing ms sqlserver using odbc?

Posted by nunb on Stack Overflow See other posts from Stack Overflow or by nunb
Published on 2010-04-28T07:16:57Z Indexed on 2010/04/28 7:23 UTC
Read the original article Hit count: 441

Filed under:
|
|
|

I am accessing a database on another machine from an OS X server. After setting up freetds through macports and creating the freetds.conf file like so:

dump file = /tmp/freetds.log
# nunb our Microsoft server
[winnt]
        host = 192.168.0.2 
        port = 1433
        tds version = 8.0

I have the following test commands that work:

Test freetds works:

tsql -S winnt -U sa
1> use myDB;
2> select count (*) from "sysObjects";
3> go

ODBC is setup through /Applications/Utilities/ODBC\ Administrator.app, with dsn "gmb" using the freeTDS driver and a ServerName of "winnt" -- testing it yields:

iodbctest "dsn=gmb;uid=sa;pwd=foo"
SQL>select count (*) from "sysObjects";

=> 792

Now I run the following code in lisp:

(require 'asdf)
(setf asdf:*central-registry* nil)
(push #P"/Users/way/ff/clbuild/systems/"  asdf:*central-registry*)

(asdf:oos 'asdf:load-op 'cffi)
(asdf:oos 'asdf:load-op 'clsql)

(asdf:operate 'asdf:test-op 'cffi)
(asdf:oos 'asdf:load-op 'clsql-odbc)
(asdf:oos 'asdf:test-op 'clsql-odbc)

(in-package :clsql-user)

(connect '("gmb" "sa" "foo") :database-type :odbc) 

This drops me in the debugger with the error:

debugger invoked on a SQL-DATABASE-ERROR in thread #<THREAD "initial thread" RUNNING {1194EA31}>:
  A database error occurred: NIL / IM002
  [iODBC][Driver Manager]Data source name not found and no default driver specified. Driver could not be loaded

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL

© Stack Overflow or respective owner

Related posts about lisp

Related posts about clsql