Page 1 of 1

dbExpress with database link

Posted: Thu 20 Jan 2011 10:27
by mmcp42
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! :)

Posted: Thu 20 Jan 2011 13:00
by AlexP
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.

Posted: Thu 20 Jan 2011 13:07
by mmcp42
ok Alex,
I'll give that a whirl
thanks for the speedy response!

cheers
Mike

Posted: Thu 20 Jan 2011 13:22
by mmcp42
tried it

and

...

...

IT WORKS

You, sir, are an absolute (*)

many thanks

Mike

Posted: Thu 20 Jan 2011 13:36
by AlexP
Hello,

It is good to see that all works. If any other questions come up, please contact us.