tomroh / bcputility

R package for fast bulk imports/exports from/to SQL Server with the bcp command line utility
https://bcputility.roh.engineering
Other
14 stars 2 forks source link

Complex Passwords #12

Closed TheLeprech4un closed 2 years ago

TheLeprech4un commented 2 years ago

Hi There!

Entering complicated passwords using characters which need escaping is very difficult with BCPImport.

BCPExport is not such a problem as it doesn't perform any ODBC connections. I can double up on escape characters for this ("\"). Unfortunately this same method does not work for BCPImport.

It would be great if the code could handle any complicated characters as part of a password string.

Cheers! :)

tomroh commented 2 years ago

Can you generate a password that is causing issues? It will help me test parsing the argument for invoking the bcp cli. Also the error with any tracebacks would be helpful.

TheLeprech4un commented 2 years ago

No problem, thanks for getting back to me. This password for example: !CJJj17$!I4KRXx*6N5Jx

It will work with Export, but not Import.

Thanks

tomroh commented 2 years ago

I tested on Windows and I'm having no issues. Does the user have the correct permissions to create a new table in the SQL Server db?

I can't do much more without the output from sessionInfo(), the code of an example where it is failing that is reproducible, and the error message from the output.

TheLeprech4un commented 2 years ago

Ahh I see! I am using Linux, which uses \ as an escape character; Windows uses ^. So it makes sense that you can't reproduce the issue.

The error I receive is "Login failed for user [Username]".

I'm pretty sure this is because the password contains reserved characters in Linux. If I use a much less complicated password, I do not have this issue.

Cheers!

tomroh commented 2 years ago

I added in shell quoting for user names and passwords.

Use:

devtools::install_github('tomroh/bcputility@devel')
TheLeprech4un commented 2 years ago

That's brilliant :) thank you so much! Happy to report this has worked!

tomroh commented 2 years ago

6ad78e63e0cb7c251308c19a8279a007dde128f9