locked
ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified RRS feed

  • Question

  • Hi,


    I am trying to connect Oracle database using DSN less connection string. (I dont want to setup DSN). I tried as per below links mentioned in other forums

    http://www.connectionstrings.com/oracle/

    Omiting tnsnames.ora

    This is another type of Oracle connection string that doesn't rely on you to have a DSN for the connection. You create a connection string based on the format used in the tnsnames.ora file without the need to actually have one of these files on the client pc.

    SERVER=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHost)(PORT=MyPort))(CONNECT_DATA=(SERVICE_NAME=MyOracleSID)));
    uid
    =myUsername;pwd=myPassword;

    So My connection String is

    OdbcConnection oraConn = new OdbcConnection("Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=MyHostName)(PORT=MyPortNo))(CONNECT_DATA=(SERVICE_NAME=MyServiceName)));uid=UserID;pwd=MyPwd;");

    When I try to open a connection, I am getting the error.

    ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

    (I tired both option Data Source= andServer=  mentioned in the URL). Please help, What am i missing here... Windows 7 - 64 bit.. so I changed the build to 64 bit (even tried with Any CPU).



    • Edited by sakthimind Sunday, April 6, 2014 4:29 AM
    Sunday, April 6, 2014 4:25 AM

Answers

  • Hi sakthimind,

    Try this:

    'dsnless using instant client form
    "driver={Microsoft ODBC for Oracle};uid=scott;pwd=tiger;server=//host:port/sid"
    
    'dsnless without tnsnames
    "driver={Microsoft ODBC for Oracle};uid=scott;pwd=tiger;server=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=127.0.0.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=ORCL)))"
    
    'dsnless using tnsnames
    "driver={Microsoft ODBC for Oracle};uid=scott;pwd=tiger;server=myTNSalias"

    Microsoft ODBC for Oracle connection strings


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Caillen Thursday, April 17, 2014 10:08 AM
    Monday, April 7, 2014 1:54 AM