Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single backslash in uid causing connection failure #24

Open
LBjerke opened this issue Oct 28, 2018 · 1 comment
Open

Single backslash in uid causing connection failure #24

LBjerke opened this issue Oct 28, 2018 · 1 comment
Labels
wontfix This will not be worked on

Comments

@LBjerke
Copy link

LBjerke commented Oct 28, 2018

Hi I am having an issue where when I am try to connect to the database with the following string
"DRIVER={ODBC Driver 17 for SQL Server};SERVER=example;Uid=domain\\test;Pwd=test" when it tries to login in it uses the user id of domain\\test instead of domain\test is there any way to pass a domain separately?
Here is the code I am using.

{-# LANGUAGE OverloadedStrings #-}

module Lib
  ( someFunc
  ) where

import Data.Text (Text, pack, singleton, snoc)
import qualified Data.Text.IO as T
import Database.ODBC.SQLServer

someFunc :: IO ()
someFunc = do
  conn <-
    connect
      ("DRIVER={ODBC Driver 17 for SQL Server};SERVER=example;Uid=domain\\test;Pwd=test")
  rows <- query conn "SELECT TOP 100 * FROM test with (nolock)" :: IO [[Value]]
  print rows
  close conn

and here is the error I get "UnsuccessfulReturnCode "odbc_SQLDriverConnect" (-1) "[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user ' domain\\test'.[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Login failed for user 'domain\\test'."

@LBjerke LBjerke changed the title Username with a domain failing Single backslash in uid causing connection failure Oct 29, 2018
@andreabedini
Copy link

AFAIK, the Microsoft ODBC Drivers for SQL Server do not support Windows authentication on Linux. You can try to use the FreeTDS drivers which do support Windows authentication also on Linux.

@chrisdone chrisdone added the wontfix This will not be worked on label Feb 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants