Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2013

    Unanswered: calling SQLDriverConnect with ";" in password fails, same with ODBC works

    on a windows 2008 machine that has the Oracle instant client 11_1 installed ( i am calling SQLDriverConnect in the following way:

    std::string str = "Driver={Oracle in instantclient11_1};Dbq=//;;Uid=myUser;pwd=a;b";
    odbcRc = SQLDriverConnect(hdbc, NULL, (SQLTCHAR*)str.c_str(), str.size(), (SQLTCHAR*)szConnStrOut, 1024, &cbConnStrOut, SQL_DRIVER_NOPROMPT)) == SQL_ERROR);

    as long as the password contains no special chars (namely semicolon) it works fine. but when I try to use special chars in the password It stops working, with an invalid username/password error.
    State: 28000 Native error: 1017 Message: [Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied

    i tried different variations of adding " (\") over the password, over the entire pwd=a;b or braces { but nothing seems to work.
    the thing is that using ODBC works! what I did was:

    open ODBC, go to System DSN tab, add "Oracle in instantclient11_1", then fill the following information:

    Data source name: Anything
    TNS Service Name: //
    User ID: myUser

    then i press test connection, enter the password "a;b"
    and it works!

    I cannot figure out what's my problem.


  2. #2
    Join Date
    Aug 2003
    Where the Surf Meets the Turf @Del Mar, CA
    Provided Answers: 1
    "If a password starts with a non-alphabetic character, or contains a character other than an alphanumeric character, the underscore (_), dollar sign ($), or pound sign (#), then it must be enclosed in double quotation marks. Otherwise, enclosing a password in double quotation marks is optional."
    You can lead some folks to knowledge, but you can not make them think.
    The average person thinks he's above average!
    For most folks, they don't know, what they don't know.
    Good judgement comes from experience. Experience comes from bad judgement.

  3. #3
    Join Date
    Jul 2013
    Thank you for your reply.
    I found documentation for SQLDriverConnect to be vague when it come to special chars in the password.
    like you said, I did try many double quotes variations but none seems to work.
    is it possible that I need to use another API?
    since connecting manually using the ODBC administration in windows works fine with special chars (";"), i assume there must be a way to do this in code.

    can anyone think of another API that might be suited?


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts