简体   繁体   中英

ORA-12154 : TNS: connection identifier specified could not be resolved

I'm performing an OracleConnection to contact a distant DataBase, like this:

OracleConnection conn = new OracleConnection("Data Source=(DESCRIPTION(ADDRESS_LIST=(PROTOCOL=TCP)(HOST=XX.XX.XX.XX)(PORT=XXXX)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XXXXX));User Id=XX_XXX_XXX; Password=XXXXXXXXXXX");

Every informations hidden are correct and correspond to the Oracle Database.

When I do conn.Open(); I have the error: ORA-12514: TNS: connection identifier specified could not be resolved

I've heard it's probably because of the tnsnames.ORA I have copied/past the tnsnames.ORA of a colleague to mine and nothing changed.

I have searched on many forums and websites, noone seems to get my answer.

Thanks in advance for your help.

Greetings,

Flo.

EDIT1:

After having tried a SQLplus connection on command-line, it worked. Visual studio seems to be the problem?

Check your connection string. It seems like you are missing a pair of parentheses:

OracleConnection conn = new OracleCollection("Data Source=((DESCRIPTION(ADDRESS_LIST=(PROTOCOL=TCP)(HOST=XX.XX.XX.XX)(PORT=XXXX)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=XXXXX)));User Id=XX_XXX_XXX; Password=XXXXXXXXXXX");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM