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();
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.
CodePudding user response:
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>