Recent

Author Topic: Lazarus 1.6.2 64bit x TOracleConnection  (Read 7794 times)

clcoelho

  • Newbie
  • Posts: 4
Lazarus 1.6.2 64bit x TOracleConnection
« on: December 14, 2016, 03:30:33 pm »
Dear Sirs,

Lazarus 1.6.2 64bit doesn't support SQLdb TOracleConnection? I saw an old post about this:
http://forum.lazarus.freepascal.org/index.php?topic=21352.0

Can anyone tell me if it is correct? This problema persists at Lazarus 1.6.2?
If I wanna use Oracle with sqldb, I must install Lazarus 32bit?

Thanks

« Last Edit: December 14, 2016, 04:59:57 pm by clcoelho »

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #1 on: December 14, 2016, 07:43:54 pm »
Lazarus 1.6.2 64bit doesn't support SQLdb TOracleConnection?
Can anyone tell me if it is correct? This problema persists at Lazarus 1.6.2?
Yes

If I wanna use Oracle with sqldb, I must install Lazarus 32bit?
Yes

There is problem that nobody have tested Oracle OCI in x64 (I do not know if Oracle provides it for x64)

DanishMale

  • Jr. Member
  • **
  • Posts: 73
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #2 on: January 23, 2017, 03:10:00 am »
I found this article describing how, perhaps, a solution could look like: http://nobytes.blogspot.de/2014/04/how-to-use-toracleconnection-under.html


 I will test it during the next few days and come back with some info.
Lazarus 2.2.4 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenVix 5.4 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 10.5.8 x64 | SQLite 3.40.0 x64 | PostgresSQL 13.1 x64

DanishMale

  • Jr. Member
  • **
  • Posts: 73
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #3 on: January 24, 2017, 01:23:14 am »
I have now tested the solution and can connect and retrieve the version number of the Oracle database.

These are the steps I have followed (See previous post for origin of solution):

he solution
The solution consists of three steps.

Step 1: Uninstall the Oracle Client 11g but back up your configuration files like TNSNAMES.ORA, LOGIN.SQL, GLOGIN.SQL. Then remove the old paths from the Windows Environment Variable PATH.

Step 2: Download and install the Oracle Instant Client 12.1c and Oracle SQL Plus for Win64. Install both programs into the same folder and put the configuration files there again. No put the path of the new client location into the PATH Variable again. Test to connect to your database with SQL*Plus. If this works, you are fine.

Step 3: Enabling the TOracleConnection in your Lazarus installation again. You have to go to the "Package" menu entry. Select "Open loaded Package". In the dialog you select the package "sqldblaz". Now click "add" and go to the tab "Add files". Then browse to the file "oracleconnection.pp" under "[Lazarus directory]\fpc\2.6.2\source\packages\fcl-db\src\sqldb\oracle" and add it to the package. The next step is, to change the file "registersqldb". Search for the first occurrence of
{$DEFINE HASORACLECONNECTION}
It's in an {$IFNDEF WIN64} section. You need to move it out there. I moved it under the line
{$DEFINE HASSYBASECONNECTION}
. Then save the file, compile the package via "compile" button. If it compiled successfully, click the button "use" and then "install". Now your Lazarus should be build new. After starting the IDE again, you should see the icon Icon of TOracleConnection again in the "SQLdb" tab.


This is configuration of the Connection:
Code: Pascal  [Select][+][-]
  1.          try
  2.             Oracle_Conn.DatabaseName:=DatabaseNameEdit.Text;
  3.             Oracle_Conn.HostName:=HostEnteredEdit.Text+':'+HostPortEnteredEdit.Text+'/'+DatabaseNameEdit.Text;
  4.             Oracle_Conn.Password:=DatabasePWEdit.Text;
  5.             Oracle_Conn.UserName:=DatabaseUserEdit.Text;
  6.             Oracle_Conn.Transaction:=SQL_Transaction;
  7.             SQL_Query.Database:=Oracle_Conn;
  8.             SQL_Query.Transaction:=SQL_Transaction;
  9.             SQL_Transaction.Database:=Oracle_Conn;
  10.             Oracle_conn.Connected := True;
  11.             if Oracle_conn.Connected then
  12.             begin
  13.               SQL_Query.SQL.Clear;
  14.               SQL_Query.SQL.Add('SELECT version FROM v$instance');
  15.               SQL_Query.Prepare;
  16.               SQL_Query.Open;
  17.               ShowMessage('Active Database : Oracle '+SQL_Query['version']);
  18.               SQL_Query.Close;
  19.               Oracle_conn.Connected := False;
  20.             end;
  21.         except
  22.           on E: EDatabaseError do
  23.           begin
  24.              ShowMessage('DB ERROR: ' + E.message);
  25.           end;
  26.           on E: Exception do
  27.           begin
  28.              ShowMessage('ERROR: ' + E.message);
  29.           end;
  30.         end;
  31.  
  32.  
  33. // Excepted output: 12.1.0.2.0
  34.  
  35. //Received output: 12.1.0.2.0
  36.  

and of course the instant client library basic 12.1.0.2.0 for Windows x64 in my projects folder, which I have downloaded from Oracle download page http://www.oracle.com/technetwork/topics/winx64soft-089540.html

« Last Edit: January 24, 2017, 01:50:20 am by DanishMale »
Lazarus 2.2.4 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenVix 5.4 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 10.5.8 x64 | SQLite 3.40.0 x64 | PostgresSQL 13.1 x64

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #4 on: February 02, 2017, 08:54:04 am »
If you can confirm, that TOracleConnection works also under x64 with x64 client then please report bug in bugtracker asking to enable TOracleConnection for x64 target.

DanishMale

  • Jr. Member
  • **
  • Posts: 73
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #5 on: February 02, 2017, 05:14:29 pm »
I can only confirm it works with Oracle 12 in x64 mode of both database and program. I can NOT confirm it will work with other versions of Oracle.
Lazarus 2.2.4 x64 | Windows 10 x64 | Windows Server 2019 x64 | OpenVix 5.4 (Linux) | MySQL Community Server 8.0 x64 | MariaDB 10.5.8 x64 | SQLite 3.40.0 x64 | PostgresSQL 13.1 x64

LacaK

  • Hero Member
  • *****
  • Posts: 691
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #6 on: February 09, 2017, 12:45:53 pm »

scalino

  • Newbie
  • Posts: 3
Re: Lazarus 1.6.2 64bit x TOracleConnection
« Reply #7 on: September 27, 2019, 12:38:43 pm »
I can only confirm it works with Oracle 12 in x64 mode of both database and program. I can NOT confirm it will work with other versions of Oracle.

I followed your advice and I can confirm it also works with a 11.2g 64bit client (installed in addition of a pre-existent 32 bits 11.2g client in a separate directory), granted that I don't use the .hostname property of the Oracle Connection, and only use .DatabaseName with the TNS name (& granted your oracle client's files/path architecture is properly done).

Thanks to you

 

TinyPortal © 2005-2018