0

I have this code:

OleDbConnection con = new OleDbConnection("Provider=MSDAORA;Data Source=192.168.117.1;User ID=*****;Password=*****;Unicode=True");
con.Open();

OleDbDataAdapter oda = new OleDbDataAdapter("Select * from BAKASHOT_PIRTY_MEIDA", con);

DataTable dt = new DataTable();
oda.Fill(dt);

con.Close();

enter image description here

All I'm trying to do is to put the query inside a table var. My server explorer recognizes the connection, but the second line throws an error:

System.Data.OleDb.OleDbException: 'Error while trying to retrieve text for error ORA-01019'

I'm kinda lost. I've been trying for the past 2 hours to connect to my database from the app.

Any advice would be appreciated, thanks.

Barbaros Özhan
  • 59,113
  • 10
  • 31
  • 55
  • Check this https://stackoverflow.com/questions/12560925/error-while-trying-to-retrieve-text-for-error-ora-01019 – MD Zand Dec 11 '22 at 10:59
  • saw that one but theres no detailed explanation and I couldnt find the path in my pc –  Dec 11 '22 at 12:11
  • Please don't paste screenshots, use formatted text. See https://meta.stackoverflow.com/q/285551 – Wernfried Domscheit Dec 11 '22 at 12:25
  • 1
    The MSDAORA provider is very old and [deprecated](https://msdn.microsoft.com/en-us/library/ms675851%28v=vs.85%29.aspx) for ages, I don't know whether it supports the [Easy Connect Naming Method](https://docs.oracle.com/en/database/oracle/oracle-database/18/ntcli/specifying-a-connection-by-using-the-easy-connect-naming-method.html). You many use another provider/driver, see https://stackoverflow.com/questions/34803106/how-to-connect-to-oracle-11-database-from-net/34805999#34805999 – Wernfried Domscheit Dec 11 '22 at 12:30

1 Answers1

0

Data Source must be an Oracle database name.

Use either

  • the full name, e.g. (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.117.1)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales_us))
  • or an alias which is typically resolved by tnsnames.ora file
  • or by Easy Connect, e.g. 192.168.117.1:1521<port>
Wernfried Domscheit
  • 54,457
  • 9
  • 76
  • 110
  • if I do that OleDbConnection con = new OleDbConnection("DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = 192.168.117.1)(PORT = 1521))(CONNECT_DATA = (SERVICE_NAME = XE)"); what I get is : System.ArgumentException: 'An OLE DB Provider was not specified in the ConnectionString. An example would be, 'Provider=SQLOLEDB;'.' –  Dec 11 '22 at 12:52
  • I did not write "the connection string must be..." , I wrote the "Data Source must be..." see https://www.connectionstrings.com/oracle/ – Wernfried Domscheit Dec 11 '22 at 16:46