ora-12560

Discussion of open issues, suggestions and bugs regarding ODAC (Oracle Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

ora-12560

Post by jrheisler » Thu 18 Oct 2012 18:29

I have an application that can uses either sql server or oracle. In switching to unidac I have no problems on my machine with both databases, but, when I send my application to my tester, they get an ora-12560 TNS:protocol adapter error.

We are both using local Oracle 11.2 databases.

I'm sure it's something simple, what am I missing?

Thanks!
Jeff

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Thu 18 Oct 2012 18:30

BTW, not sure if it was clear, but the tester can connect with SQL Server, but not Oracle.

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Thu 18 Oct 2012 18:44

Also, we are using Delphi 7, and 4.1.6 for unidac

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Thu 18 Oct 2012 21:43

Sorry to keep dripping info, I just want to be as complete as possible.

In addition, the second, tester's machine, does work with oracle via toad, sqlplus, as well as our oracle version of our software, written with DOA components.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ora-12560

Post by AlexP » Fri 19 Oct 2012 09:16

hello,

This error can occur for many reasons.
Please, make sure that if several Oracle clients are installed on this machine, you are using the correct one; by default the default client is used. The Oracle client can be changed in UniConnection.SpecificOptions

Code: Select all

UniConnection1.SpecificOptions.Values['HomeName'] := 'HomeName';
You should also check that the client data are present in the register in the HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE branch, and that they are correct. Check that the path to the Oracle client is specified in the environment variables. Check the tnsnames.ora file, it must contain a record for the database you are trying to connect to.

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Fri 19 Oct 2012 12:42

Alex, thank you, but I am still confused, my machine, the one that this works on, doesn't have a HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE branch, and it works fine for unidac, a doa application, toad, and sql plus.

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Fri 19 Oct 2012 13:40

Not sure if this helps, but trying to use oracle via direct connect, my machine works fine, but the other machine gives an ORA-12505 error.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ora-12560

Post by AlexP » Fri 19 Oct 2012 14:12

hello,

If the connection string for the direct mode is hard-coded in your application, the settings (SID and PORT) must be the same on the rest of machines,
this also applies to the OCI mode (tnsnames.ora files must contain the same Service_Name with which your application works)

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Fri 19 Oct 2012 22:25

The connection string is entered at log in, with the app remembering.

I am at a total loss

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ora-12560

Post by AlexP » Tue 23 Oct 2012 08:40

hello,

Please compile the console application code shown below, and run it from the command line with the following parameters:

Project1.exe login/password@IP_ADDRESS:PORT:SID TRUE for the Direct mode, and

Project1.exe login/password@SID for the OCI mode, and let us know the results.

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Ora,
  OraError;

var
  OraSession: TOraSession;
begin
  OraSession := TOraSession.Create(nil);
  try
    OraSession.ConnectString := ParamStr(1);
    if ParamStr(2) = '' then
      OraSession.Options.Direct := False
    else
      OraSession.Options.Direct := StrToBool(ParamStr(2));
    try
      OraSession.Connect;
      Writeln('Connected!');
    except
      on E: EOraError do
        Write(Format('ORA-%d, ErrorMessage: %s', [E.ErrorCode, E.Message]));
    end;
  finally
    Readln;
    OraSession.Free;
  end;
end.
P.S. If you try to connect in the Direct mode using ServiceName instead of SID, you should specify the follwing in the connection string:

login/password@IP_ADDRESS:PORT:SN=ServiceName

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Fri 01 Feb 2013 22:04

Alex,

Sorry I missed this reply, and had moved on to another project. Well, I'm back on our Oracle project and have the same problem.

I tried to compile your console app but don't have ora, or oraerror dcu files.

btw, I am using Universal Data Access Components 4.6.11 for Delphi 7.

Thanks!!!
Jeff

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ora-12560

Post by AlexP » Mon 04 Feb 2013 13:22

Hello,

You can use the following code for UniDAC:

Code: Select all

program Project1;

{$APPTYPE CONSOLE}

uses
  SysUtils,
  Uni,
  OraclassesUni,
  OracleUniProvider,
  OraErrorUni;

var
  UniConnection: TUniConnection;
  Username, Password, Server: String;
  ConnectMode: TConnectMode;
begin
  ParseConnectString(ParamStr(1), Username, Password, Server, ConnectMode);
  UniConnection := TUniConnection.Create(nil);
  try
    UniConnection.Server := Server;
    UniConnection.Username := Username;
    UniConnection.Password := Password;
    if ParamStr(2) <> '' then
      UniConnection.SpecificOptions.Values['Direct'] := ParamStr(2);
    try
      UniConnection.Connect;
      Writeln('Connected!');
    except
      on E: EOraError do
        Write(Format('ORA-%d, ErrorMessage: %s', [E.ErrorCode, E.Message]));
    end;
  finally
    Readln;
    UniConnection.Free;
  end;
end.

jrheisler
Posts: 48
Joined: Tue 25 Oct 2011 17:47

Re: ora-12560

Post by jrheisler » Mon 04 Feb 2013 16:54

Alex,

I wasn't passing in the server info properly. Thank you so much!

Jeff

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: ora-12560

Post by AlexP » Tue 05 Feb 2013 09:35

Hello,

Glad to see that you solved the problem. If you have any other questions, feel free to contact us

Post Reply