简体   繁体   中英

Can't connect to remote Oracle server using ADO.Net | Connection string error?

I have been trying to connect to an Oracle server using the following connection string:

            OracleConnection conn = new OracleConnection();
            conn.ConnectionString = @"Data Source=
(DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.206.0.23)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = ORCLWEX3)
    )
 )
;User Id= RAMNIVAS_CI;Password= RAMNIVAS_CI;Persist Security Info=True;";
            conn.Open();

But getting the following error:

System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.

Although I have already installed it.

I have been able to connect to that server using Oracle Sql Developer. The settings are :
Oracle SQL Developer设置 The TNSNAMES files is like this:

# tnsnames.ora Network Configuration File: F:\app1\product\11.1.0\db_1\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.

ORCLWEX1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle-db.newvisionsoftware.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = ORCLWEX1)
    )
  )

ORCLWEX2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle-db2.newvisionsoftware.com)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = ORCLWEX2)
    )
  )

ORCLWEX3 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 10.206.0.23)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = ORCLWEX3)
    )
  )

I have been told to use the last one: ORACLEWEX3.
I know there is some problem in the connection string and would be grateful if someone could help me.

I don't think you need to use 'Persist Security info' if you're using username/password. Take a look at: http://connectionstrings.com/oracle for more examples.

Additionally, you could try using Oracle's own .net provider: http://www.oracle.com/technetwork/topics/dotnet/index-085163.html see if that works better for you.

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