Using odp.NET

I am trying to connect to oracle from c#.NET environmet using the following connection string n odp.net

string connectionsstring="User id=xxx;passowrd=xxx;Data Source=xxx";

it throws a runtime exception stating

ora-12154:tns could not resolve service name

I have allready checked the service name in the TNSnames.ora file

Can somebody please provide me witha solution to this problem

Thanks

Rohit Mehta




Answer this question

Using odp.NET

  • DaveyC11111

    Mike, Irrespective of which provider you use, the error "ORA-12154" tells that for some reason, the alias lookup on TNSNAMES.ora file failed. Can you look up the Oracle forums link that was posted earlier to see if it solves your problem.

    Hope this helps.



  • crazy

    Hi,

    I received the following response from Oracle regarding this issue:-

    The ( ) issue is Oracle bug 3807408, which is fixed in rdbms patch 9207 Patch 6 (apply it to the client machine), on Metalink as patch number 4928723.
    I'm not aware of any other workarounds, apart from moving the app to a directory without parenthesis in it.

    Mike


  • hologram

    Hi I'm also getting a weird situation with connecting to oracle in c# under .net.

    The following snippet of code runs fine in a test application but fails in my main application with the ORA-12154: TNS could not resolve service name

    System.Data.OleDb.OleDbConnection conn1 = new System.Data.OleDb.OleDbConnection( );

    conn1.ConnectionString = "PROVIDER=OraOLEDB.Oracle.1;User ID=xxx;Password=xxx;Data Source=axdb.mwd.local;persist security info=false";

    conn1.Open( );

    It throws the exception on the Open statement, but only in the main application.

    I can't guess what is different between the two applications

    Any ideas of where to look

    Mike


  • Magic Hat 9

    Hi,

    I finally found out what is wrong and its kind of weird, but reproducible.

    If I build a exe which runs the following:-

    System.Data.OleDb.OleDbConnection conn1 = new System.Data.OleDb.OleDbConnection( );

    conn1.ConnectionString = "PROVIDER=OraOLEDB.Oracle.1;User ID=xxx;Password=xxx;Data Source=axdb.mwd.local;persist security info=false";

    conn1.Open( );

    If the project path contains a ) character then it fails with ORA-12154

    e.g.

    C:\Visual Studio 2005\Projects\ThrowAway\oledbproblem\bin\Debug)\oledbproblem.exe

    If I then rename the path to

    C:\Visual Studio 2005\Projects\ThrowAway\oledbproblem\bin\Debug\oledbproblem.exe

    Then all is OK.

    This issue is occurring with OraOLEDB.dll 9.2.0.7

    Of course this represents an issue to us, because we can't control the installation directory that a client may choose to install our software.

    Can anybody think of a work around

    Thanks

    Mike

     

     

     


  • GavinG

  • Using odp.NET