Page 1 of 1

Access Violation when using OCI in Fedora 4

Posted: Tue 09 Jan 2007 19:58
by jeremy
I have created a simple program without any user interface to test connection to Oracle Database. Connecting to database using ODAC net works fine both in Windows XP and Fedora 4. That is, I have set the TOraSession.Options.Net to true and used the connect string as ‘scott/[email protected]:1521:orcl’.

But I wanted to use OCI connect string as ‘scott/tiger@orcl’. Hence we set the TOraSession.Options.Net to false and used the connect string as ‘scott/tiger@orcl’. We added TNS_ADMIN variable in Windows and LINUX to point to oracle_home/network/admin and in that location exists a file tnsnames.ora which contains necessary information about orcl. Our program works under windows. But in Fedora it gives the following error:

Exception EAccessViolation in module OracleTestConsole at 080588AD.
Access violation at address 01A387BE, accessing address 00000000.

I have set the following environment variables:

ORACLE_HOME
TNS_ADMIN=$ORACLE_HOME/network/admin
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib

I tested sqlplus using scott/tiger@orcl and it works fine and we are able to connect to the database.

The following is my source code:

program OracleTestConsole;
{$APPTYPE CONSOLE}
uses
Ora, SysUtils;
var
Query : TOraQuery;
Session : TOraSession;
begin
Writeln('Creating Session...');
Session := TOraSession.Create(nil);
Query := TOraQuery.Create(nil);
Session.AutoCommit := True;
Session.ConnectPrompt := False;
Session.LoginPrompt := False;
Session.Options.Net := False;
Session.ConnectString := 'scott/tiger@orcl';
WriteLn('Connecting...');
Session.Connect;
if (Session.Connected ) then
WriteLn('Session successfully connected');
Query.Session := Session;
Query.SQL.Text := 'select * from emp';
Writeln('Executing query...');
Query.Open;
while not Query.Eof
do
begin
Writeln(Query.Fields[1].AsString);
Query.next;
end;
{while}
Writeln('Closing Query & Session');
Query.Close;
Session.Disconnect;
end.

Could it be that I missed any environment setting?

Thanks,
Jeremy

Posted: Wed 10 Jan 2007 08:39
by Plash
Please supply us the following information:
- Exact version of ODAC. You can see it in About sheet of TOraSesion Editor
- Exact version of your Oracle server and client
- Version of Kylix

Posted: Wed 10 Jan 2007 10:03
by jeremy
Please find the version numbers below.

Delphi version: Version 7
ODAC version : 5.80.0.35
Oracle Server: 10.2.0.1
Oracle Client: 10.2.0.1
Kylix 3.0

Thanks,
Jeremy

Posted: Wed 10 Jan 2007 12:49
by jeremy
I have found that OCIVersion is set to 8000 under LINUX in DetectOCI in OraCall. When I changed it to 10201 the program worked. Is there a way of getting the version of OCI from the system rather than hardcoding ?

Posted: Thu 11 Jan 2007 08:57
by Plash
The problem with access violation was fixed in ODAC 5.80.0.37. You should upgrade your ODAC.
OCI version detection under Linux will be implemented in ODAC 6. We are planning to implement this functionality partially in the next ODAC build as well.