Page 1 of 1

Not retrieving all columns from Oracle Table

Posted: Wed 19 Oct 2011 11:49
by MainMeat
Hi Devart,

I have the following small test application (Lazarus) that simply retrieves data form an oracle data base which contains 7 columns in the table:

Code: Select all

session := TOraSession.Create(nil);
qry := TOraQuery.Create(nil);
qry.session := session;

Session.ConnectString := 'testUser/Oracle123@//192.168.1.70/orcldv.testOracle.com';
Session.Connect;
Writeln('CONNECTED TO ORACLE');
Session.AutoCommit := true;
qry.Autocommit := true;  

qry.sql.text := 'select column1, column2, column3, column4, column5, column6, column7 from table_test';
Writeln(qry.sql.text);

qry.Open;
qry.last;
qry.first;
Writeln('Columns retrieved : ', qry.fields.count); //THIS RETURNS 6, should be 7 rather?

while not qry.eof do
   begin
        Writeln(qry.Fields[0].AsString, ' ' , qry.Fields[1].AsString, ' ' , qry.Fields[2].AsString, ' ' , qry.Fields[3].AsString, ' ' , qry.Fields[4].AsString, ' ' , qry.Fields[5].AsString, ' ' , qry.Fields[6].AsString);
        qry.Next;
end;
The output from the above is as follows:

Code: Select all

CONNECTED TO ORACLE
select column1, column2, column3, column4, column5, column6, column7 from table_test

Columns Retrieved : 6
1 2 3 4 5 6 Error : List index (6) out of bounds
The values 1 -> 6 is what I entered a single record in the corresponding field in the table.

Why does the qry not return all 7 columns but rather give me an exception? Can I only retrieve 6 columns?

Many thanks for any help and advice!

Posted: Thu 20 Oct 2011 06:54
by AlexP
Hello,

The number of fields in Dataset is limited to 6 in the ODAC version for Lazarus. This limitation is only in the Trial edition, the number of fields is not limited in the full version.

Posted: Thu 20 Oct 2011 11:47
by MainMeat
HI AlexP,

I have forwarded and email to [email protected].

I have purchased a license for the source code edition of ODAC witth the intention of using this license in Lazarus, using the Linux OS.

Unfortunately I am not able to extract the libraries not see the Linux / Lazarus version of the libraries after running the provided ODAC exe on a Windows platform.

Can you please assist in resolving this?

I need to compile an application in Lazarus / FPC which is running in Linux which needs to access an Oracle database, and I believe the licenses I have purchased should allow me todo this now.

Many thanks!

Posted: Thu 20 Oct 2011 12:17
by AlexP
Hello,

To install ODAC for Lazarus under Linux you need to unpack files in Windows, move the unpacked folder to the PC with Linux, open and install the ..\ODAC\Source\Lazarus1\dclodac10.lpk package in Lazarus.

Posted: Thu 20 Oct 2011 12:38
by MainMeat
Hi AlexP,

Thanks, your post and information below is noted.

However, as noted in my email to [email protected] I am unable to unpack the files in Windows as it seems the password I have on records does not work. (Developer License: 05827)

Can this password issue be resolved?

Posted: Thu 20 Oct 2011 12:57
by AlexP
Hello,

Please contact our Sales department to get login and password for Source Code Edition at sales*devart*com

Posted: Thu 20 Oct 2011 14:27
by MainMeat
Hello,

I have contacted your sales department and was provided with an updated Password - many thanks for the prompt response. I was now able to extract the files.

No when I try to install the ODAC\Source\Lazarus1\dclodac10.lpk package into Lazarus, I get the following compilation error:

ODAC/Source/DBMonitorMessages.pas(623,14) Error: Identifier not found "timeval"

Is there something else I should be doing in order to install the component?

I am using FPC 2.4.2 with Lazarus 0.9.30 on Fedora 15, but also tried it on Ubuntu 10.10 with the same unsuccessful compilation as mentioned above

Posted: Fri 21 Oct 2011 06:27
by MainMeat
HI,

As an further update, using Windows and Lazarus 0.9.30 with FPC 2.4.2 the compilation of the component is a success. The issue does seem to be related to the GetTickCount function in the DBMonitorMessage unit on line 623 as noted in my previous post when compiling the same component under linux.

Is there something specific to be done in order to get the ODAC component to compile under linux?

Posted: Fri 21 Oct 2011 08:22
by AlexP
Hello,

Thank you for the information, we have reproduced and fixed this problem. This fix will be included in the next ODAC version. For now, you may make the following changes to DBMonitorMessages.pas and rebuild ODAC:

Code: Select all

uses
  Classes, SysUtils, Math,
{$IFDEF MSWINDOWS}
  Windows,
{$ENDIF}
{$IFDEF LINUX} //add
unix,           //add
{$ENDIF}       //add

replace  
  gettimeofday(tv, nil);
with
  fpgettimeofday(@tv, nil);

Posted: Sun 23 Oct 2011 08:36
by MainMeat
Great thanks - all seems good now.

Posted: Mon 24 Oct 2011 05:56
by AlexP
Hello,

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