Problem with Oracle.Net connection string

I am new to oracle and trying to just connect to oracle db, but I'm not sure where to find the correct credentials to enter the connection string. I just downloaded and installed oracle express edition on my machine and then installed .Net links. My simple code is here:

 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();
            }

I get TNS: Failed to resolve the specified connection id exception. Probably because my connection string is incorrect, this is what I guess. I can’t even go to the Server Explorer dialog box in Visual Studio and correctly check the connection to my version of oracle db.

, ? ... oracle express , .Net-, ?

+3
1

, , tnsnames.ora XE.

Easy Connect Express. - , , :

user id=hr;password=hr;data source=hr-server
user id=hr;password=hr;data source=hr-server:1521
user id=hr;password=hr;data source=hr-server:1521/XE

hr- dns ip .

+2

All Articles