?
Solved

problem in opening DB connection in C# to Oracle

Posted on 2004-11-03
7
Medium Priority
?
437 Views
Last Modified: 2008-02-01
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();
                  }

0
Comment
Question by:jfz2004
7 Comments
 
LVL 6

Assisted Solution

by:ryerras
ryerras earned 450 total points
ID: 12489594
Hmm looks like, your connection string is in incorrect format

it should be
String connString="User id=jennifer;Password=welcome;source=testserver";

now try
0
 
LVL 6

Assisted Solution

by:Chester_M_Ragel
Chester_M_Ragel earned 150 total points
ID: 12490033
0
 
LVL 8

Accepted Solution

by:
Razzie_ earned 150 total points
ID: 12492216
Take a look at this previous asked question about the exact same error:

http://www.experts-exchange.com/Databases/Crystal_Reports/Q_20788720.html

HTH,

Razzie
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:jfz2004
ID: 12494521
Hi,  ryerras,

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

Jennifer
0
 

Author Comment

by:jfz2004
ID: 12494821
Hi, Chester_M_Ragel,

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

Thanks,

Jennifer
0
 
LVL 6

Assisted Solution

by:ryerras
ryerras earned 450 total points
ID: 12495130
ok. Did you try to login in sqlplus, is that working? what version of oracle client are you using?
0
 

Author Comment

by:jfz2004
ID: 12495478
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
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question