TNS 名を使用せずに Oracle DB に接続しようとしていますが、次のエラーが発生し続けます: {"ORA-12504: TNS:listener was not given the SERVICE_NAME in CONNECT_DATA"}
string oradb = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=105.1.12.190)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=OMP1)));User ID=user;Password=pass;";
OracleConnection conn = new OracleConnection(oradb); // C#
conn.Open();
OracleCommand cmd = new OracleCommand();
cmd.Connection = conn;
cmd.CommandText = "SELECT cast(Count(*) as varchar(20)) as trig FROM ZDMSN.TRIGGER_TEST";
「TNS Names」ファイルの内容は次のとおりです。
OMP1=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=105.1.12.193)
(PORT=1521)
)
(CONNECT_DATA=
(SID=OMP1)
)
)