Link to home
Start Free TrialLog in
Avatar of jfz2004
jfz2004

asked on

problem in opening DB connection in C# to Oracle

I have the following source code (see the end of this msg)  in my  TestOracle app.
But it is always giving error:
System.Data.OracleClient.OracleException: Error while trying to retrieve text for error ORA-12154

   at System.Data.OracleClient.DBObjectPool.GetObject(Object owningObject, Boolean& isInTransaction)
   at System.Data.OracleClient.OracleConnectionPoolManager.GetPooledConnection(String encryptedConnectionString, OracleConnectionString options, OracleConnection owningObject, Boolean& isInTransaction)
   at System.Data.OracleClient.OracleConnection.OpenInternal(OracleConnectionString parsedConnectionString, Object transact)
   at System.Data.OracleClient.OracleConnection.Open()
   at TestOracle.Form1..ctor() in c:\testoracle\testoracle\form1.cs:line 38

What's wrong?

Thanks a lot.

Jennifer

=========================================

String connString="Data Source=Oracle8i;Server=testserver;Uid=jennifer;Pwd=welcome";
                  OracleConnection conn = new OracleConnection(connString);
                  
                  
                  try
                  {
                        conn.Open();
                  }
                  catch(Exception e)
                  {
                        Console.WriteLine(e.ToString());
                  }
                  finally
                  {
                        conn.Close();
                  }

SOLUTION
Avatar of ryerras
ryerras

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfz2004
jfz2004

ASKER

Hi,  ryerras,

Thanks for your input. But I tried:
String connString="User id=jennifer;Password=welcome;source=testserver";
Still got the same error.

Jennifer
Avatar of jfz2004

ASKER

Hi, Chester_M_Ragel,

I checked that I do have tnsnames.ora and it contains
the correct names.

Thanks,

Jennifer
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jfz2004

ASKER

Hi,
Thanks for all the help. I just found out what was wrong.
Here's how I figured it out:
1. I sent the source to my co-worker and he could run it on his
machine without any problem.
2. That means some setting is not right on my machine.
3. So I checked that my tnsnames.ora is there and readable and correct.
4. Finally, I checked that we compare our registry and found I don't
have ORACLE in my registry.

After I inserted the registry the ORACLE, it worked.

What a learning curve!

Thanks for all your help!

Jennifer