Re: DMO SQLServer->Connect failed for user name with special characters



strSQLLoginName = L"abc;xyz"

strSQLLoginPassword = L"abc"

HRESULT hrConnect = spServer->Connect( rkstrCurrentServerName.c_str(),
strSQLLoginName.c_str(), strSQLLoginPassword.c_str() );

This code also gives the same error. Also, if i paste user name as abc;xyz
in Enterprise Manager or Query Analyzer I get the same error.

The same thing works with ADO. I had to just escape the special characters
in the connection string. While can pass the username & password directly to
the ADOConnection->Connect() method. But same is not working on DMO.

Thanks.

- Ajey

"Vikram Vamshi" <vikram.vamshi@xxxxxxxxxxxxxxxxxxx> wrote in message
news:OrYsYoujFHA.3316@xxxxxxxxxxxxxxxxxxxxxxx
> Also try to put quotes around the user name (try both single quotes and
> double quotes, one of them should be able to handle special characters)
>
> hth
>
> --
> Vikram Vamshi
> Database Engineer
> Eclipsys Corporation
> "Ajey" <ajey5@xxxxxxxxxxx> wrote in message
> news:uZXxuFojFHA.2644@xxxxxxxxxxxxxxxxxxxxxxx
>>I think it's mainly due to semi-colon. The error message displays the user
>>names till the character before the semi-colon. Also, same username &
>>password does not work while registering the sql server using Enterprise
>>Manager or connecting through Query Analyser.
>>
>> - Ajey
>>
>> "Vikram Vamshi" <vikram.vamshi@xxxxxxxxxxxxxxxxxxx> wrote in message
>> news:uMKZSCkjFHA.3900@xxxxxxxxxxxxxxxxxxxxxxx
>>>/ is an escape character in cpp, you have to replace / with // in your
>>>string for it to work properly.
>>> hth
>>> --
>>> Vikram Vamshi
>>> Database Engineer
>>> Eclipsys Corporation
>>> "Ajey" <ajey5@xxxxxxxxxxx> wrote in message
>>> news:OqwRXccjFHA.3316@xxxxxxxxxxxxxxxxxxxxxxx
>>>> Actual user name was a`~!@#$%^&*()_+|-=[];',./{}:"<>?
>>>>
>>>> "Ajey" <ajey5@xxxxxxxxxxx> wrote in message
>>>> news:ujnaqXcjFHA.1428@xxxxxxxxxxxxxxxxxxxxxxx
>>>>> Hi,
>>>>> If I give a user name or password having special character (mainly
>>>>> semi-colon) then I cannot connect to the SQL Server. Following is the
>>>>> error:
>>>>>
>>>>> Login failed for user 'a`~!@#$%^&*()_+|-=[]'.
>>>>> TCP Provider: An existing connection was forcibly closed by the
>>>>> remote host.
>>>>>
>>>>> Communication link failure
>>>>> Invalid connection string attribute
>>>>>
>>>>> However, this error was coming in my Cpp code. I tried with VB, I
>>>>> works. Also, I got same error from Enterprise Manager.
>>>>> Is this a defect or known behavior in DMO?
>>>>>
>>>>>
>>>>> TIA,
>>>>> Ajey
>>>>>
>>>>
>>>>
>>>
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: Help: Wrapping quotes around selected text
    ... that's why Query Analyzer doesn't ... Clear the option to replace "straight quotes" with "smart quotes". ... Type one apostrophe in both the Find What box ... >> Set oRg = ActiveDocument.Range ...
    (microsoft.public.word.vba.general)
  • Re: Cannot connect to Query Analyzer
    ... And what happens if while you are in Enterprise Manager, ... go to the menu to Tools and then select Query Analyzer? ... noticed that I could not open Query Analyzer from within Enterprise Manager. ... to be able to change the password on my local sql server? ...
    (microsoft.public.sqlserver.connect)
  • Re: **different place for creating a new table**
    ... Both the Enterprise Manager and Query Analyzer tools allow you to specify ... specifies the owner explicitly in its internally generated script but QA ... If you want to create the tables using QA the same way EM does, specify the ...
    (microsoft.public.sqlserver.programming)
  • Re: Alignment result
    ... Copy the result from Enterprise Manager in a word editor (like Microsoft ... Word) and set the font to Courier New and Size 10. ... The default font for results in Query Analyzer is ... > It gave the result on view pannel like that... ...
    (microsoft.public.sqlserver.clients)
  • Re: What does Cut do?
    ... Regard to your question, by mistake, I used Cut instead of Copy in a ... production server and I thought that I had deleted the table. ... How often do you open Enterprise Manager to look at tables, ... > less mystical tool that combines the features of EM and Query Analyzer). ...
    (microsoft.public.sqlserver.server)