Run time vs. Design time

nisbus

Member
Hi,

I'm having a strange problem with the TOracleSession component.

I set username/password and database in the Object inspector of my Delphi 2005 and change the connected property to true. Everything works smoothly.
Then I compile and run my project and at the startup I get the error:

"ORA-12154: TNS:could not resolve service name"

I've also tried creating the session at runtime and then connecting but the same error comes up.
How is this possible?

nisbus
 
Perhaps you have set the Oracle Home in the Delphi IDE (Oracle > Preferences menu)? This will affect the design-time behavior, but not the run-time behavior.
 
What do you mean by Oracle > Preferences? There is no Oracle menu in Delphi.
I haven't done anything as far as settings go besides just installing the software (I'm setting up a clean computer).
Please elaborate.

nisbus
 
After installing Direct Oracle Access, the Delphi IDE contains a new Oracle menu (to the left of the Window menu). Here you can set design time preferences, but from your reply I can safely assume that you have not done so.

Perhaps you have enabled the TOracleSession.DesignConnection property? In that case the values entered for the LogonUsername, LogonPassword and LogonDatabase are not propagated to runtime. This can cause ORA-12154.

If this does not apply either, then please enable SQL*Net tracing by setting "trace_level_client = USER" in the sqlnet.ora configuration. The trace file should allow us to determine what is happening.
 
Hello Marco,

I've managed to solve the problem for now.
I created a new project and copied all of the code from the old project. It connected nicely and everything was working. I then went to refill my coffee and when I came back I had the same error again. I then created the third project and it is still working.
There are other people using these components in the company and they aren't experiencing any problems with it. If I figure out what the problem actually is I'll let you know.

BTW. I don't have an Oracle menu in the Delphi toolbar. The TOracle components appear under the Data Access tab in the tool palette and that's it.

Thanks,
nisbus
 
Back
Top