Note that there are some explanatory texts on larger screens.

plurals
  1. POConnection String Problem Oracle .Net
    text
    copied!<p>I am new to oracle and am trying to simply connect to an oracle db, but I am not sure where to find the proper credentials to put in the connection string. I simply downloaded and install oracle express edition on my machine, then installed the .Net references. My simple code is here:</p> <pre><code> string oradb = "Data Source=XE;User Id=hr;Password=hr;"; OracleConnection conn = new OracleConnection(oradb); // C# try { conn.Open(); string sql = "SELECT FIRST_NAME FROM EMPLOYEES WHERE EMAIL='SKING'"; // C# OracleCommand cmd = new OracleCommand(sql, conn); cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); // C# dr.Read(); //label1.Text = dr["dname"].ToString(); // C# retrieve by column name label1.Text = dr.GetString(0).ToString(); // return a .NET data type //label1.Text = dr.GetOracleString(0).ToString(); // return an Oracle data type } catch (OracleException ex) { label1.Text = ex.Message; } finally { conn.Close(); } </code></pre> <p>I am getting a TNS:could not resolve the connect identifier specified exception. Its probably because my connection string is wrong is what I am guessing. I cannot even go to the Server Explorer dialog in Visual Studio and test a connection correctly to my oracle db. </p> <p>What steps do I need to take to figure out the proper credentials to plug into my connection string? Or wording it like this.... If you were going to install oracle express on your machine, then connect to a .Net app what steps would you take to set up the connection string?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload