I've tried a wide range of connection strings trying to find one that will connect LogParser to my SQL Server 2017 (or SQL Azure) instance. I've tried both the ODBC and Native drivers. I've created and verified a DSN. Visual Studio will make the connection - LogParser's error message is misleading:
Error Message: [Microsoft][ODBC Driver 13 for SQL Server][SQL Server]Login
failed for user ''
The user id property was supplied -- i've tried 'User ID=xxx'; UserID=xxx' and 'User_ID=xxx'. And when hitting SQL Azure (instead of on-prem) I've tried with and without the #[servername] suffix.
The DSN version:
-o:SQL -createTable:ON -oConnString:"Driver={ODBC Driver 13 for SQL Server};DSN=odbc_bw33;Connection Timeout=30;" -e:1
Task aborted.
Error connecting to ODBC Server
SQL State: 08001
Native Error: 0
Error Message: [Microsoft][ODBC Driver 13 for SQL Server]Neither DSN nor
SERVER keyword supplied
Again, note that the connection string has a DSN name supplied - the error message is wrong.
I have been able to connect to SQLExpress with:
Driver={SQL Server Native Client 11.0};Server=(LocalDB)\MSSQLLocalDB;AttachDbFilename=E:\seeder.mdf;Integrated Security=True;Connect Timeout=30;
Related
I have recently joined a new company and I have a project where I am trying to connect a Microsoft SQL Server to Power BI to automate a report and I am running into some issues. I have successfully connected the server to a SQL environment in DBeaver so I know that the host name and port number are correct.
I have not successfully created an ODBC connection for though I have tried. Using the System DSN, I have tried both the SQL Server and the ODBC Driver 17 for SQL Server and both failed connecting. With the SQL Server option, I made up a name and user the following format for the server host:port and then used my windows NT credentials on the next page and left everything else as default all the way through testing the connection. I got the below error for this one:
Microsoft SQL Server ODBC Driver Version 10.00.19041
Running connectivity tests...
Attempting connection
[Microsoft][ODBC SQL Server Driver][DBNETLIB]Invalid connection.
TESTS FAILED!
For the ODBC Driver 17 for SQL Server option, I did the same settings with defaults and I got the below error:
Microsoft ODBC Driver for SQL Server Version 17.04.0000
Running connectivity tests...
Attempting connection
[Microsoft][ODBC Driver 17 for SQL Server]SQL Server Network Interfaces: Connection string is not valid [87].
[Microsoft][ODBC Driver 17 for SQL Server]Login timeout expired
[Microsoft][ODBC Driver 17 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.
TESTS FAILED!
When I try and import the data into Power BI using the SQL Server option, and I put the host:port into the server slot and the SQL in its place, it then ask for me to sign in. I am using my windows credentials which is accurate and so I press connect and I get the below error:
"The server name provided doesn't match the server name on the sql server ssl certificate
Please contact your administrator or see the link below for more information. Alternatively,
you could change your Connection encryption settings. Would you like to continue using an
unencrypted connection?"
I am not sure how to fix this so I can run my SQL Server script in Power BI. Does anyone have any ideas?
I installed the following SQL Server on a Linux Container as this site:
https://learn.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-ver15&pivots=cs1-bash
But when I am trying to connect from outside I get the following errors:
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: The wait operation timed out.
.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired.
Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error
has occurred while establishing a connection to SQL Server. Server is not found or not accessible.
Check if instance name is correct and if SQL Server is configured to allow remote connections. For
more information see SQL Server Books Online..
From inside the container I am able to connect either as localhost either from the container;s ip.
Any suggestion?
I am trying to connect to MS SQL Server using pyodbc on local system and on connect to instance i get error:
[2020-06-21 15:39:04.110750]: ('08001', '[08001] [Microsoft][ODBC Driver 13 for SQL Server]SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF]. (-1) (SQLDriverConnect); [08001] [Microsoft][ODBC Driver 13 for SQL Server]Login timeout expired (0); [08001] [Microsoft][ODBC Driver 13 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. (-1)')
My SQL Server is Express 2005 and try with drivers:
{ODBC Driver 13 for SQL Server}
{ODBC Driver 17 for SQL Server}
{SQL Native Client}
I test in sqlcmd with this command:
C:\Users\Moein>sqlcmd -S '.\Moein' -U 'sa' -P 'xxxx'
HResult 0xFFFFFFFF, Level 16, State 1
SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..
Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
My Code :
import pyodbc
conn = pyodbc.connect(f'DRIVER={SQL Native Client};SERVER=.\Moein;DATABASE=Moein;UID=sa;PWD=xxxx',autocommit=True)
cursor = conn.cursor()
More:
Test -l 600 switch for login timeout more in sqlcmd > not answer recived
Test computername\instance and 127.0.0.1\instance > Not changed
Try full reinstall sql server on local > noting changed things
i found my problem
i use this connection string with pipe mode:
conn = pyodbc.connect('DRIVER={ODBC Driver 13 for SQL Server};ServerName=Provider=SQLOLEDB.1;SERVER=.\testsv;DATABASE=test;Persist Security Info=False;UID=sa;PWD=xxxxx;Data Source=np:\\.\pipe\MSSQL$testsv\sql\query',autocommit=True)
We have a UNIX machine which includes R engine on it and installed SQL Server ODBC Driver 11.
We need to connect R to SQL Server. SQL Server currently works on another machine, so we tried to connect R to SQL Server with the code below.
library(RODBC)
dbhandle <- odbcDriverConnect('driver=ODBC Driver 11 for SQL Server;server=10.XXX.XX.XX:1663;')
But getting that error:
Warning messages: 1: In odbcDriverConnect("driver=ODBC Driver 11 for SQL Server;server=10.XXX.XX.XX:1663;") :
[RODBC] ERROR: state HYT00, code 0, message [unixODBC][Microsoft][ODBC Driver 11 for SQL Server]Login timeout expired 2: In odbcDriverConnect("driver=ODBC Driver 11 for SQL Server;server=10.XXX.XX.XX:1663;") :
[RODBC] ERROR: state 08001, code 87, message [unixODBC][Microsoft][ODBC Driver 11 for SQL Server]A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online. 3: In odbcDriverConnect("driver=ODBC Driver 11 for SQL Server;server=10.XXX.XX.XX:1663;") :
[RODBC] ERROR: state 08001, code 87, message [unixODBC][Microsoft][ODBC Driver 11 for SQL Server]SQL Server Network Interfaces: Connection string is not valid [87]. 4: In odbcDriverConnect("driver=ODBC Driver 11 for SQL Server;server=10.XXX.XX.XX:1663;") : ODBC connection failed
If I run telnet to SQL Server from UNIX machine, it works perfectly. I mean there is a healthy connection between these two machine.
How can we connect R to SQL Server without using DSN?
I changed delimiter which between server and port from : to , . It fixed my problem.
dbhandle <- odbcDriverConnect('driver=ODBC Driver 11 for SQL Server;server=10.XXX.XX.XX,1663;')
I'm getting the below error while connecting the sql server through unix box, i have created the DSN for the sql server and passing the user id and pass word to connect the sql server,
here is the error
SQLSTATE=42000 ON SQLCONNECT(HDBC) DIAGNOSTIC=[FreeTDS] [SQL SERVER]
Login Failed.