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.O racleExcep tion: Error while trying to retrieve text for error ORA-12154
at System.Data.OracleClient.D BObjectPoo l.GetObjec t(Object owningObject, Boolean& isInTransaction)
at System.Data.OracleClient.O racleConne ctionPoolM anager.Get PooledConn ection(Str ing encryptedConnectionString, OracleConnectionString options, OracleConnection owningObject, Boolean& isInTransaction)
at System.Data.OracleClient.O racleConne ction.Open Internal(O racleConne ctionStrin g parsedConnectionString, Object transact)
at System.Data.OracleClient.O racleConne ction.Open ()
at TestOracle.Form1..ctor() in c:\testoracle\testoracle\f orm1.cs:li ne 38
What's wrong?
Thanks a lot.
Jennifer
========================== ========== =====
String connString="Data Source=Oracle8i;Server=tes tserver;Ui d=jennifer ;Pwd=welco me";
OracleConnection conn = new OracleConnection(connStrin g);
try
{
conn.Open();
}
catch(Exception e)
{
Console.WriteLine(e.ToStri ng());
}
finally
{
conn.Close();
}
But it is always giving error:
System.Data.OracleClient.O
at System.Data.OracleClient.D
at System.Data.OracleClient.O
at System.Data.OracleClient.O
at System.Data.OracleClient.O
at TestOracle.Form1..ctor() in c:\testoracle\testoracle\f
What's wrong?
Thanks a lot.
Jennifer
==========================
String connString="Data Source=Oracle8i;Server=tes
OracleConnection conn = new OracleConnection(connStrin
try
{
conn.Open();
}
catch(Exception e)
{
Console.WriteLine(e.ToStri
}
finally
{
conn.Close();
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi, Chester_M_Ragel,
I checked that I do have tnsnames.ora and it contains
the correct names.
Thanks,
Jennifer
I checked that I do have tnsnames.ora and it contains
the correct names.
Thanks,
Jennifer
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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
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
ASKER
Thanks for your input. But I tried:
String connString="User id=jennifer;Password=welco
Still got the same error.
Jennifer