Ora 12154 error

前端 未结 9 1543
长发绾君心
长发绾君心 2021-01-20 00:09

I recently deploy one web application in one of my development servers. I\'m using oracle, asp.net and c#. When I run the application in the server everything works fine, bu

9条回答
  •  时光取名叫无心
    2021-01-20 00:58

    I had faced the similar issue. The below code was working in my system but was not working in another server even though I had added a tns entry in tnsnames.ora file.

    con = new OracleConnection();
    con.ConnectionString = "User Id=username;Password=password;Data Source=uit45";
    con.Open(); // throws error here
    

    After digging and digging, I found out the solution for this. We need to ignore the entry in tns file and can be given tns entry as connection string, which worked fine for me. Try the below code.

    con = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=db-uit45.xxx)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=uit45)));User Id=username;Password=password");
    con.Open();
    

    Note that you need to give the associated values, especially for HOST,PORT,SID,User Id and Password.

提交回复
热议问题