Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.


Welcome, Guest
Guest Settings
Help

Thread: Getting Error while connecting Oracle through DbExpress


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Nov 11, 2014 2:42 AM Last Post By: Alf Christopher... Threads: [ Previous | Next ]
karthik thirumo...

Posts: 23
Registered: 9/26/13
Getting Error while connecting Oracle through DbExpress  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 24, 2014 4:41 AM
i'm getting access violation error while connection oracle through DbExpress. Below is my code,
(getting error when executing Conn.Connected := true; line)

procedure TForm1.Button1Click (Sender: TObject);
var
  conn: TSQLConnection;
  Query: TSQLQuery;
begin
  Conn := TSQLConnection. Create (nil);
  try
    Conn.ConnectionName := 'OracleConnection';
    Conn.DriverName := 'Oracle';
    Conn.GetDriverFunc := 'getSQLDriverORACLE';
    Conn.KeepConnection := true;
    Conn.LibraryName := 'dbxora30.dll';
    Conn.LoginPrompt := false;
    Conn.VendorLib := 'oci.dll';
    Conn.Params.Add ('HostName=orcl');
    Conn.Params.Add ('Database=orcl126');
    Conn.Params.Add ('User_Name=snt_live');
    Conn.Params.Add ('Password=log');
    *Conn.Connected := true;*
    Query := TSQLQuery. Create (nil);
    try
      Query.SQLConnection := Conn;
      Query.GetMetadata := true;
      Query.CommandText := 'Select xmlagg ((xmlelement (e, docid || '','')).extract (''//text()'')).getclobval() '+
                           ' from localgrnhdr lg, localgrndtl ld '+
                           ' where lg.cancel = ''F'' and lg.localgrnhdrid = ld.localgrnhdrid and  rownum <= 5';
      Query.Open;
      Query.First;
      while not Query.Eof do begin
        //do some thing
        Query.Next;
      end;
      Query.Close;
    finally
    Query.Free;
    end;
    Conn.Connected := false;
  finally
  Conn.Free;
  end;
end;


Please give me a solution.

Edited by: karthik thirumoorthi on Sep 24, 2014 4:41 AM

Edited by: karthik thirumoorthi on Sep 24, 2014 5:02 AM
Alf Christopher...

Posts: 25
Registered: 10/10/98
Re: Getting Error while connecting Oracle through DbExpress  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Nov 11, 2014 2:42 AM   in response to: karthik thirumo... in response to: karthik thirumo...
HAve you tried to define a datamodule and populate it with a tSQLConnection and add those components and setup the same and then try to connect by setting the sqlconnection to true?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02