1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Rep Power

    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
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2007
    Rep Power

    Try adding quotes to the password you are passing

    I am not sure, but i would try quoting the password string as "a;b".

IMN logo majestic logo threadwatch logo seochat tools logo