Recent

Author Topic: OracleConnection + instantclient = ORA-12541  (Read 17842 times)

GolfCat

  • New Member
  • *
  • Posts: 17
Re: OracleConnection + instantclient = ORA-12541
« Reply #15 on: March 18, 2014, 10:32:52 pm »
I have checked and when I supply the correct hostname I get ORA-12514, when I set localhost as hostname I get ORA-12541. This is for OracleConnection + instantclient. When using zeosconnection and instantclient I can use the correct hostname or localhost as hostname and connect OK. Strange that you guys get different results.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: OracleConnection + instantclient = ORA-12541
« Reply #16 on: March 21, 2014, 09:36:02 am »
If you get 12514 that matches my incorrect sid case. Not too much of an Oracle guru but perhaps tnsnames.ora is interfering with a service definition here?

Perhaps post the info/properties you use for zeos connection as well as Oracleconnection could be useful?
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

GolfCat

  • New Member
  • *
  • Posts: 17
Re: OracleConnection + instantclient = ORA-12541
« Reply #17 on: March 24, 2014, 03:25:55 pm »
Code: [Select]
procedure TForm1.btnOraClick(Sender: TObject);
begin
  OracleConnection1.DatabaseName:='UTV02';
  OracleConnection1.HostName:='utv-oradb234.utv.mycompany.se';
  OracleConnection1.UserName:='sbo';
  OracleConnection1.Password:='sbo';
  OracleConnection1.Connected:=True;
  if OracleConnection1.Connected then
  begin
    StatusBar1.SimpleText := 'Connected';
  end
  else begin
    StatusBar1.SimpleText := 'No Connection';
  end;
end;
This fails with ORA-12514
Code: [Select]
procedure TForm1.btnZeosClick(Sender: TObject);
begin
  ZConnection1.Protocol := 'oracle';
  ZConnection1.Database := 'UTV02';
  ZConnection1.HostName := 'utv-oradb234.utv.mycompany.se'
  ZConnection1.User := 'sbo';
  ZConnection1.Password := 'sbo';
  ZConnection1.Connected := True;
  if ZConnection1.Connected then
  begin
    StatusBar1.SimpleText := 'Connected';
  end
  else begin
    StatusBar1.SimpleText := 'No Connection';
  end;
end;         
Here I get 'Connected'
All other properties are default.
In tnsnames.ora it looks like this:
Code: [Select]
UTV02=
  (DESCRIPTION=
    (ADDRESS=
      (PROTOCOL=TCP)
      (HOST=utv-oradb234.utv.mycompany.se)
      (PORT=1523)
    )
    (CONNECT_DATA=
      (SERVICE_NAME=utv02.utv.mycompany.se)
    )
  )
« Last Edit: March 24, 2014, 03:31:47 pm by GolfCat »

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: OracleConnection + instantclient = ORA-12541
« Reply #18 on: March 24, 2014, 04:46:22 pm »
I vaguely remember having once used tnsnames.ora with FPC.... However, too many scare memories for somebody who just wanted to test various dbs...

Code: [Select]
OracleConnection1.DatabaseName:='UTV02';
Perhaps try with the service name instead of the tnsnames entry:
Code: [Select]
OracleConnection1.DatabaseName:='utv02.utv.mycompany.se'
also then you'll need to specify the port as it's not default 1521
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: OracleConnection + instantclient = ORA-12541
« Reply #19 on: March 24, 2014, 04:53:09 pm »
To specify port 1523 on host hostname you'd probably do something like
Code: [Select]
OracleConnection1.hostname:='hostname:1523';
but that's Oracle lower level stuff (OCI) which I know nothing about...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

GolfCat

  • New Member
  • *
  • Posts: 17
Re: OracleConnection + instantclient = ORA-12541
« Reply #20 on: March 25, 2014, 08:20:33 am »
Tested all of this today and got ORA-12154
Searched the forum and found the solution:
I completely removed the hostname and IT FUNCTIONED.

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: OracleConnection + instantclient = ORA-12541
« Reply #21 on: March 25, 2014, 11:03:55 am »
Great news!

I modified
http://wiki.lazarus.freepascal.org/oracle#OOP_access_to_Oracle
hope it's correct - corrections welcome.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018