Groups | Blog | Home
all groups > sql server connect > july 2005 >

sql server connect : DMO SQLServer->Connect failed for user name with special characters


Ajey
7/21/2005 12:59:19 PM
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

Ajey
7/21/2005 1:07:42 PM
Actual user name was a`~!@#$%^&*()_+|-=[];',./{}:"<>?

[quoted text, click to view]

Vikram Vamshi
7/21/2005 6:07:21 PM
/ 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
[quoted text, click to view]

Ajey
7/22/2005 12:00:00 AM
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

[quoted text, click to view]

Vikram Vamshi
7/22/2005 12:00:00 AM
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
[quoted text, click to view]

Vikram Vamshi
7/22/2005 11:33:49 AM
Can you post your cpp code that can reproduce the issue?

--
Vikram Vamshi
Database Engineer
Eclipsys Corporation
[quoted text, click to view]

Ajey
7/25/2005 12:00:00 AM
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

[quoted text, click to view]

AddThis Social Bookmark Button