Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connect SBCL on Windows to SQL Server using Integrated Authentication

What is the path of least resistance in getting an SBCL application running on Windows to connect to a SQL Server instance, using integrated authentication?

I have found posts on connecting from CL-SQL to SQL Server using ODBC connections but as far as I can tell, there is no way to this without first manually setting up a DSN.

Is there a simple way to accomplish this?

like image 608
futuranon Avatar asked Oct 14 '22 11:10

futuranon


2 Answers

There is a cl-mssql library that uses FreeTDS to communicate with MSSQL server. According to http://www.freetds.org/userguide/domains.htm, FreeTDS will use Integrated Authentication if you specify the login like 'DOMAIN\Username'. So it might work with cl-mssql (though I haven't used it).

like image 178
dmitry_vk Avatar answered Oct 30 '22 14:10

dmitry_vk


The path of least resistance for this (SBCL, Windows, no-DSN) seems to be plain-odbc.

(asdf:load-system :plain-odbc)
(use-package :plain-odbc)
(setf conn (connect-generic :driver "{SQL Server}"
                            :database "dbname"
                            :server "servername"
                            :trusted_connection "yes"))
(exec-query conn "select * from some_table")

Don't use (connect-sql-server ...) as it requires a default DSN, *default-sql-server-dsn*.

There may be a better driver to specify, as well.

like image 30
futuranon Avatar answered Oct 30 '22 14:10

futuranon