-
Notifications
You must be signed in to change notification settings - Fork 78
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
Getting MatchError even when passing correct credential #116
Comments
State: Tds.Protocol |
I can't test this since I don't have env with mirroring, but from binary you posted in second comment it stuck on eventchange message for mirroring partner. This line. It must be removed for tail, and return it for further processing since transaction and other useful stuff is also there and we need to read it. But I'm confused why it isn't work for you, here is what code does: before_match_tail = <<10, 68, 0, 82, 0, 65, 0, 90, 0, 79, 0, 66, 0, 73, 0, 83, 0, 81, 0, 76, 0 , 0 .... >>
<<
10, # <--- new_value_size unsigned 1 byte integer, in this case it tells that we have to read 10 ucs2 chars ahead
68, 0, 82, 0, 65, 0, 90, 0, 79, 0, 66, 0, 73, 0, 83, 0, 81, 0, 76, 0, # <--- _new_value is matched as binary-size(10)-unit(16) ucs2 string
0, # <--- as expected one byte set to 0x00
rest # <--- the rest of the binary or nil if it is at the end
>> so this should work, right? tail = <<10, 68, 0, 82, 0, 65, 0, 90, 0, 79, 0, 66, 0, 73, 0, 83, 0, 81, 0, 76, 0, 0, 173, 54, 0, 1, 116, 0, 0, 4, 22, 77, 0, 105, 0, 99, 0, 114, 0, 111, 0, 115, 0, 111, 0, 102, 0, 116, 0, 32>>
# there is more bytes in your message "...", but this should enough to prove above
<<len::unsigned-8, server_name::binary-size(len)-unit(16), 0x00, rest::binary>> = tail
server_name = server_name
|> String.to_charlist()
|> Enum.reject(&(&1 == 0))
|> IO.iodata_to_binary()
|> IO.inspect(label: "ServerName") Above should print your server name Just one thing, what is your erlang, elixir and TDS version? |
erlang OTP: 21 tdsL 2.1 |
Could you try last code snippet on your computer?, no deps is required, it can be run in iex too |
Hi Mjaric Haven't tried yet.. Let me try and tell you Also, I am really sorry I can not share env |
Hey I am getting the server name DRAZOBISQL |
You don't have to share env, don't worry. We can fix this here too. Next thing that could be an issue is Tds.BinaryUtils.binary/2 macro. What I'd like you to do is to checkout
This should remove usage of binary/2 macro. Let me know if app can login then on the same server? thanks |
@nitesh-christies Any luck? |
Hi @mjaric |
Thank you for asking.... Still, no luck tried all this |
State: Tds.Protocol
[error] GenServer #PID<0.601.0> terminating
** (RuntimeError) connect raised MatchError exception. The exception details are hidden, as they may contain sensitive data such as database credentials. You may set :show_sensitive_data_on_connection_error to true when starting your connection if you wish to see all of the details
(tds) lib/tds/tokens.ex:362: Tds.Tokens.decode_envchange/2
(tds) lib/tds/tokens.ex:52: Tds.Tokens.decode_tokens/2
(tds) lib/tds/messages.ex:66: Tds.Messages.parse/3
(tds) lib/tds/protocol.ex:507: Tds.Protocol.decode/2
(tds) lib/tds/protocol.ex:562: Tds.Protocol.login/1
(tds) lib/tds/protocol.ex:408: Tds.Protocol.connect/2
(db_connection) lib/db_connection/connection.ex:69: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: nil
The text was updated successfully, but these errors were encountered: