I'm having issues connecting to a sql server database from an openbsd box using unixODBC. When I use isql I get through just fine:
$ isql localProdSqlServer jegdemir GBE#oct
+---------------------------------------+
| Connected! |
| |
| sql-statement |
| help [tablename] |
| quit |
| |
+---------------------------------------+
SQL>
so I know the DSN is setup and unixODBC is working properly. However when I crack open clisp and try to connect using plain-odbc I can't get there:
$ clisp
<..snip..>>
[1]> (asdf:oos 'asdf:load-op :plain-odbc)
<..snip..>
[2]> (setf *con* (plain-odbc:connect "localProdSqlServer" "jegdemir" "GBE#oct"))
*** - [unixODBC][FreeTDS][SQL Server]Unable to connect to data source, error
code 0, State: S1000.
The following restarts are available:
ABORT :R1 Abort main loop
Break 1 [3]>
I'm fairly new to lisp so I'm having a bit of trouble diagnosing the issue. Any help would be most appreciated.
Depending on how plain-odbc works, you may need to specify a DSN in /etc/odbc.ini, something like:
[localProdSqlServer]
Driver = FreeTDS
Description = localProdSqlServer TDS driver (Sybase/MS SQL)
Trace = No
Servername = localProdSqlServer
Database = DATABASE_NAME
As an alternative, the CLSQL library has an ODBC backend that supports connection strings:
(clsql:connect '("friendly-server-name" "friendly-username" ""
:connection-string "DRIVER={FreeTDS};SERVER=localProdSqlServer;DATABASE=DATABASE_NAME;UID=jegdemir;PWD=GBE#oct;PORT=1433;TDS_Version=8.0;APP=clsql")
:database-type :odbc)
At work I use CLSQL to connect to SQL Server all the time.