dbExpress with database link

dbExpress with database link

Postby mmcp42 » Thu 20 Jan 2011 10:27

I need to use an oracle database link to get data using

SELECT <> FROM <>@<>

It all works fine using SQL Developer (using tnsnames.ora)
If I delete the tnsnames.ora entry however it all goes 'orribly wrong!

does dbExpress support this form of database link?

or maybe there's another way...

thanks! :)
mmcp42
 
Posts: 3
Joined: Thu 20 Jan 2011 10:21

Postby AlexP » Thu 20 Jan 2011 13:00

Hello,

dbExpress driver for Oracle supports Oracle dblink.

Below is a small sample demonstrating how to use Oracle dblink:



CREATE PUBLIC DATABASE LINK remote
CONNECT TO remote_user_name IDENTIFIED BY remote_password
USING 'REMOTE_HOST:PORT/SID';


var
SQLConnection: TSQLConnection;
SimpleDataSet: TSimpleDataSet;
begin
SQLConnection:= TSQLConnection.Create(nil);
SQLConnection.ConnectionName :='Devart Oracle';
SQLConnection.DriverName := 'DevartOracle';
SQLConnection.GetDriverFunc:= 'getSQLDriverORA';
SQLConnection.LibraryName:= 'dbexpoda.dll';
SQLConnection.VendorLib:= 'OCI.DLL';
SQLConnection.Params.Values['User_Name']:='user_name';
SQLConnection.Params.Values['Password']:='password';
SQLConnection.Params.Values['DataBase']:='local';
SQLConnection.Execute('CREATE PUBLIC DATABASE LINK remote CONNECT TO remote_user_name IDENTIFIED BY remote_password USING ''REMOTE_HOST:PORT/SID''',nil);

SQLConnection.Execute('Select * from dual@remote', nil);

also you can connect to Oracle in the direct mode.
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Postby mmcp42 » Thu 20 Jan 2011 13:07

ok Alex,
I'll give that a whirl
thanks for the speedy response!

cheers
Mike
mmcp42
 
Posts: 3
Joined: Thu 20 Jan 2011 10:21

Postby mmcp42 » Thu 20 Jan 2011 13:22

tried it

and

...

...

IT WORKS

You, sir, are an absolute (*)

many thanks

Mike
mmcp42
 
Posts: 3
Joined: Thu 20 Jan 2011 10:21

Postby AlexP » Thu 20 Jan 2011 13:36

Hello,

It is good to see that all works. If any other questions come up, please contact us.
AlexP
Devart Team
 
Posts: 5530
Joined: Tue 10 Aug 2010 11:35


Return to dbExpress driver for Oracle

Copyright © 1998 - @DateTime.Now.Year Devart. All rights reserved.