Page 1 of 1

ora-12560

Posted: Thu 18 Oct 2012 18:29
by jrheisler
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

Re: ora-12560

Posted: Thu 18 Oct 2012 18:30
by jrheisler
BTW, not sure if it was clear, but the tester can connect with SQL Server, but not Oracle.

Re: ora-12560

Posted: Thu 18 Oct 2012 18:44
by jrheisler
Also, we are using Delphi 7, and 4.1.6 for unidac

Re: ora-12560

Posted: Thu 18 Oct 2012 21:43
by jrheisler
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.

Re: ora-12560

Posted: Fri 19 Oct 2012 09:16
by AlexP
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.

Re: ora-12560

Posted: Fri 19 Oct 2012 12:42
by jrheisler
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.

Re: ora-12560

Posted: Fri 19 Oct 2012 13:40
by jrheisler
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.

Re: ora-12560

Posted: Fri 19 Oct 2012 14:12
by AlexP
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)

Re: ora-12560

Posted: Fri 19 Oct 2012 22:25
by jrheisler
The connection string is entered at log in, with the app remembering.

I am at a total loss

Re: ora-12560

Posted: Tue 23 Oct 2012 08:40
by AlexP
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

Re: ora-12560

Posted: Fri 01 Feb 2013 22:04
by jrheisler
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

Re: ora-12560

Posted: Mon 04 Feb 2013 13:22
by AlexP
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.

Re: ora-12560

Posted: Mon 04 Feb 2013 16:54
by jrheisler
Alex,

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

Jeff

Re: ora-12560

Posted: Tue 05 Feb 2013 09:35
by AlexP
Hello,

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