Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 523
  • Last Modified:

heterogeneous JOIN

I have a question a bit like this open already, but since I need the answer now I will try to ask it again.
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=20144514

I try this example: http://community.borland.com/article/0,1410,25204,00.html
It shows how to move data betweem two databases, using two TDatabases with databasenames: aaa,bbb and one Query with this SQL statement
INSERT INTO ":aaa:Country" SELECT * FROM ":bbb:Country"

I get this error: No such table or correlation name, when I try to execute it.

If I use the aliases instead of the databasenames it works fine, but I then have to enter the password and username explicitly, how do I remove this login-dialog.

I uses Interbase, I know that interbase doesn't support heterogeneous JOIN and that BDE performs the function instead.
0
glx2k
Asked:
glx2k
1 Solution
 
EpsylonCommented:
Did you set both TDatabase.LoginPrompt to false?
0
 
glx2kAuthor Commented:
yes of course :-)
0
 
ITugayCommented:
Hi glx2k,

here is sample procedure that able open database without login dialog.

!!!Important!!!!! All TQuery and TTable inside your app. must be inactive (active = false).

procedure OpenDatabase(DBName, User, Password: String);
var
  D: TDatabase;
begin
  D := Session.FindDatabase(DBName);
  if D = nil
    then D:=TDatabase.Create(Session);
  D.DatabaseName := DBName;
  D.LoginPrompt := false;
  D.Params.Clear;
  D.Params.Add('USER NAME=' + User);
  D.Params.Add('PASSWORD=' + Password);
  D.Open;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  OpenDatabase('IBWORK', 'SYSDBA', 'masterkey');
  Query1.Open;
end;


-----
Igor

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
glx2kAuthor Commented:
Hmm Igor ... it seems to work, I will test it a bit more, but great news so far :)

I don't understand why it works, I have tried the same thing with a TDatabase at design time.
When I try to set DatabaseName I get a duplicate database error, but your code works fine.
0
 
LucasCCommented:
I think your TQuery must have the Database property blanked (no Database selected) to allow you use heterogeneus joins.
Did you tried it?
Good Luck
0
 
ITugayCommented:
I have no idea what's wrong. Can you show me your code?
0
 
glx2kAuthor Commented:
Yes, but I think I have handled the problem :)
So thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now