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

shell behaves erratically after exiting go-sqlcmd #87

Closed
kiilivi opened this issue May 16, 2022 · 3 comments
Closed

shell behaves erratically after exiting go-sqlcmd #87

kiilivi opened this issue May 16, 2022 · 3 comments
Assignees

Comments

@kiilivi
Copy link

kiilivi commented May 16, 2022

I have tried to use go-sqlcmd in Macbook Pro M1 Docker, but it doesn't seem to be working. My Dockerfile is based on Fedora 36. This is how I installed go-sqlcmd:

RUN curl -L https://github.com/microsoft/go-sqlcmd/releases/download/v0.7.0/sqlcmd-v0.7.0-linux-arm64.tar.bz2 > sqlcmd-v0.7.0-linux-arm64.tar.bz2
RUN tar jxf sqlcmd-v0.7.0-linux-arm64.tar.bz2 -C /usr/bin
RUN rm sqlcmd-v0.7.0-linux-arm64.tar.bz2

If I run the sqlcmd command without parameters in Docker container, it exits with the following error:

unable to open tcp connection with host 'localhost:1433': dial tcp 127.0.0.1:1433: connect: connection refused

That's ok, but somehow the shell behaves erraneously after that.

If I run the sqlcmd with proper parameters, it doesn't seem to do anything. No errors, no output, but it certainly doesn't update database either. I use this kind of command:

/usr/bin/sqlcmd -S host.docker.internal -U <user> -d <database> -i <script>.sql  2>&1

I use the same command line with MacOS sqlcmd (original version, not go-sqlcmd) and it works just fine.

Is this a bug or I'm doing something wrong?

@stuartpa
Copy link
Collaborator

stuartpa commented May 16, 2022

Is it possible SSL/TLS is not configured for the target server to allow an encrypted connection, if so does adding the switch "-N disable" help?

This error (although generic) is the error I'd expect in the case an encrypted connection cannot be established

unable to open tcp connection with host 'localhost:1433': dial tcp 127.0.0.1:1433: connect: connection refused

This implementation of sqlcmd has "encrypt connection" set to the default (per breaking changes, and the -?)

@kiilivi
Copy link
Author

kiilivi commented May 19, 2022

I was a bit unclear... I wanted to show that error message in order to prove that I'm using the right binary. The database is running outside the docker container, so there's no service at 127.0.0.1 1433, so there's nothing wrong with the error message.

I managed to sort out most of my problems (I was using go-sqlcmd in a Robot Framework script and the error was a bit concealed), but go-sqlcmd still makes bash shell command line behave erratically after exiting sqlcmd. I can live with that, since I run it from scripts, but it is weird behaviour.

@dzsquared dzsquared changed the title ARM Linux binary doesn't work in Macbook Pro M1 Docker environment shell behaves erratically after exiting go-sqlcmd May 19, 2022
@dzsquared dzsquared assigned stuartpa and shueybubbles and unassigned stuartpa May 19, 2022
@stuartpa
Copy link
Collaborator

I tested the latest build since #88 was merged, the shell behaving erratically issue seems to be fixed.

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

3 participants