1

I have a database in oracle 11 g express edition. I have installed ODCA (ODAC121012Xcopy_32bit) in my local machine. I am trying to connect to the oracle db from a simple console c#.net application. My c# code looks like this -

using System;
using Oracle.DataAccess.Client;

namespace ClassLibrary3
{
     public class Class1
     {
         public static void Main(String[] args)
         {
               string host = "10.237.209.126";

               string connStr = "Data Source=(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP) (HOST = " + host + ")(PORT = " + 1521 + "))(CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = " + "edcadmin" + ")));Password=" + "edcadmin" + ";User ID=" + "edcadmin";
               OracleConnection conn = new OracleConnection();
               conn.ConnectionString = connStr;

               try
               {
                    conn.Open();
               }
               catch (Exception ex)
               {
                    Console.WriteLine(ex.ToString());
               }

              Console.ReadLine();
         }
     }
 }

The host is a 32 bit machine and it has windows 2008 server installed.

When I run this program I get an exception like this

Oracle.DataAccess.Client.OracleException
     at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure, Boolean bCheck, Int32 isRecoverable)
     at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src)
     at Oracle.DataAccess.Client.OracleConnection.Open()
     at ClassLibrary3.Class1.Main(String[] args)

I have checked the connection string multiple times, it is correct one. I installed SQLDeveloper and I could see my database edcadmin with the userId and password edcadmin, edcadmin respectively.

I have spent lot of time trying to figure out what is going wrong. Any help will be highly appreciated.

Edit : Here is the screen shot of the exception

enter image description here

Sujith Kp
  • 1,075
  • 3
  • 14
  • 27

0 Answers0