-
-
Notifications
You must be signed in to change notification settings - Fork 69
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
Support for MSSQL named pipe (np:) and shared memory (lpc:) DSNs #365
Comments
Just FYI -- I'm looking into how this can be supported with |
@fsiler Please try adding a For example, if you wanted to connect to |
Apologies, I just read your original issue here, and it seems you had tried that. That error is not from |
To make it easy, I mean an anonymous import like this: import (
_ "github.com/microsoft/go-mssqldb/namedpipe"
_ "github.com/microsoft/go-mssqldb/sharedmemory"
) |
@fsiler I just pushed a commit for go install github.com/xo/usql@master
usql sqlserver://my_named_pipe/?protocol=np If you're able to connect with either See the relevant |
This is amazing, thanks- I am afraid I have to go for today but will test tomorrow. |
I'm sorry for not knowing more Go, @kenshaw . I get errors on compile: $ go install github.com/xo/usql@master
# github.com/xo/usql/drivers/sqlite3
go\pkg\mod\github.com\xo\u[email protected]\drivers\sqlite3\sqlite3.go:31:29: undefined: sqlite3.Error
go\pkg\mod\github.com\xo\u[email protected]\drivers\sqlite3\sqlite3.go:35:29: undefined: sqlite3.ErrN
$ uname -a
MINGW64_NT-10.0-20348 10-234-39-242 3.4.7-ea781829.x86_64 2023-07-05 12:05 UTC x86_64 Msys |
@kenshaw Windows 2022, go installed via Chocolatey. I tried compiling in both Powershell and git bash, identical error messages. |
@fsiler Sorry, I just woke up, I wasn't thinking. You should be able to build without the SQLite3 dependency in the following way:
Without the |
@fsiler It's likely the error you're encountering is due to a missing C lib build dependency. I wouldn't know what that is off the top of my head. |
I was able to get $ usql sqlserver://localhost
Connected with driver sqlserver (Microsoft SQL Server 15.0.2000.5, RTM, Express Edition (64-bit))
Type "help" for help.
ms:localhost=> select rand();
1
--------------------
0.2864187065348336
(1 row)
ms:localhost=>
ms:localhost=> ^D
$ usql sqlserver://sql//query/?protocol=np
error: sqlserver: no named pipe instance matching '/QUERY/' returned from host 'sql'
$ usql sqlserver://sql/query/?protocol=np
error: sqlserver: no named pipe instance matching 'QUERY' returned from host 'sql'
$ usql sqlserver://sql\\query/?protocol=np
error: parse "sqlserver://sql\\query/?protocol=np": invalid character "\\" in host name
$ usql sqlserver://sql/sql/query/?protocol=np
error: sqlserver: no named pipe instance matching 'SQL/QUERY' returned from host 'sql'
$ usql sqlserver://sql/sql\\query/?protocol=np
error: sqlserver: no named pipe instance matching 'SQL\QUERY' returned from host 'sql'
$ usql sqlserver://localhost/sql\\query/?protocol=np
error: sqlserver: no named pipe instance matching 'SQL\QUERY' returned from host 'localhost'
# at this point I renamed the named pipe from "sql\query" to "sql" and restarted MSSQL
$ usql sqlserver://localhost/sql/?protocol=np
error: sqlserver: no named pipe instance matching 'SQL' returned from host 'localhost'
$ usql sqlserver://localhost/sql/?protocol=np
error: sqlserver: no named pipe instance matching 'SQL' returned from host 'localhost'
$ usql sqlserver://localhost/ssnc_sqlexpress/sql/?protocol=np
error: sqlserver: no named pipe instance matching 'SSNC_SQLEXPRESS/SQL' returned from host 'localhost'
$ usql sqlserver://localhost/sql?protocol=lpc
$
# yes, usql just quit silently, no error, with exit code 1. Another thing that's interesting is I can't connect with DSNs of the form Another thing I noticed is that I often get the error message " Finally, it looks like there may be a code path problem which is defaulting to named pipes for some reason. Note (actual address elided): # same thing happens when using a DNS name other than `localhost`
$ usql sqlserver://$IPADDRESS
error: sqlserver: no named pipe instance matching '' returned from host '$IPADDRESS' |
I would really need to ask you to write a minor Go program to try to connect directly then using Go. I'll try to get this to work on my local system, but I (personally) have not run SQL Server on Windows since something like 2006. I would really ask the Microsoft SQL Server Go driver devs to help if you could. |
For the moment, it seems that the working assumption is that I will have TCP available. However, I'm also having issues connecting to SQL 2008 that I haven't had a chance to track down, so I may circle back and pursue this further. |
Is your feature request related to a problem? Please describe.
In my environment, I'm concerned about my ability to use TCP for instrumentation and would like to have shared memory and named pipes available.
Describe the solution you'd like
It appears that the upstream microsoft/go-mssqldb library supports
np:
andlpc:
DSNs. When I trydata_source_name: 'lpc:SQLEXPRESS'
ordata_source_name: 'lpc://SQLEXPRESS'
in the current release, I get:No metrics gathered, [from Gatherer #1] invalid URL
. I've also triedlpc:$IPADDRESS
,lpc:localhost
, andlpc:(local)
. I'm having trouble tracing down where the "invalid URL" portion of the message comes from.I get a different error message when attempting DSNs such as
data_source_name: 'sqlserver://localhost?protocol=lpc
:No metrics gathered, [from Gatherer #1] No protocol handler is available for protocol: 'lpc'
Describe alternatives you've considered
We might well just use TCP. I'm trying to mitigate the risk and understand the codebase here.
Additional context
n/a
The text was updated successfully, but these errors were encountered: