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

Unable to connect SQL Server LocalDB #305

Open
fortunewalla opened this issue Aug 20, 2023 · 5 comments
Open

Unable to connect SQL Server LocalDB #305

fortunewalla opened this issue Aug 20, 2023 · 5 comments

Comments

@fortunewalla
Copy link

fortunewalla commented Aug 20, 2023

Is there support for MS SQL Server LocalDB?

SQL Server LocalDB Instance : (localdb)\MSSQLLocalDB

So I entered the host as (localdb)\MSSQLLocalDB with pubs as the database. (This hostname works in Excel when connecting using SQL Server connection)

select 1+2;

It gives this error.

Error evaluating panel:
[INFO] 2023-08-20T22:49:28 DataStation Runner (Go) 0.11.0
[INFO] 2023-08-20T22:49:28 Evaling database panel: Untitled panel #1
[INFO] 2023-08-20T22:49:28 Failed to eval: parse "sqlserver://user:pass@(localdb)\\MSSQLLocalDB:1433?database=pubs": invalid character "\\" in host name

BTW it works with another similar software called DatabaseBrowser

image

@eatonphil
Copy link
Member

Maybe try replacing (localdb)\MSSQLLocalDB with 127.0.0.1?

@fortunewalla
Copy link
Author

fortunewalla commented Aug 22, 2023

Maybe try replacing (localdb)\MSSQLLocalDB with 127.0.0.1?

Thanks for trying to help out but It gives the following error.

Error evaluating panel:
[INFO] 2023-08-22T18:19:13 DataStation Runner (Go) 0.11.0
[INFO] 2023-08-22T18:19:13 Evaling database panel: Untitled panel #1
[INFO] 2023-08-22T18:19:16 Failed to eval: unable to open tcp connection with host '127.0.0.1:1433': dial tcp 127.0.0.1:1433: connectex: No connection could be made because the target machine actively refused it.

This would make it use TCP connection instead of ODBC connection.

As per the original error, it cannot parse the \ slash in the server name properly. I think? 🤔

@eatonphil
Copy link
Member

DataStation just passes the connection string along to the underlying library. So you could ask this question in https://github.com/denisenkom/go-mssqldb (the library used for connecting to SQL Server) and maybe they'll know!

@fortunewalla
Copy link
Author

hopefully a resolution will be found by someone. 🤞🏼

@fortunewalla
Copy link
Author

fortunewalla commented Aug 27, 2023

So as per the suggestion given on this page: https://weblogs.asp.net/jongalloway/sql-force-the-protocol-tcp-named-pipes-etc-in-your-connection-string

I tried with the connection string Server=np:(localdb)\MSSQLLocalDB

It now gives a different error where it parses everything after : as a port number.

Error evaluating panel:
[INFO] 2023-08-27T16:40:05 DataStation Runner (Go) 0.11.0
[INFO] 2023-08-27T16:40:05 Evaling database panel: Untitled panel #1
[INFO] 2023-08-27T16:40:05 Failed to eval: parse "sqlserver://@Server=np:(localdb)\\MSSQLLocalDB?database=pubs": invalid port ":(localdb)\\MSSQLLocalDB" after host

P.S. I'm posting it here also for future use by someone. 😇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants