Solved

heterogeneous JOIN

Posted on 2001-07-03
7
511 Views
Last Modified: 2012-05-04
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
Comment
Question by:glx2k
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 13

Expert Comment

by:Epsylon
ID: 6249045
Did you set both TDatabase.LoginPrompt to false?
0
 

Author Comment

by:glx2k
ID: 6249054
yes of course :-)
0
 
LVL 9

Accepted Solution

by:
ITugay earned 200 total points
ID: 6249371
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
Industry Leaders: 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!

 

Author Comment

by:glx2k
ID: 6249687
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
 

Expert Comment

by:LucasC
ID: 6252577
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
 
LVL 9

Expert Comment

by:ITugay
ID: 6252598
I have no idea what's wrong. Can you show me your code?
0
 

Author Comment

by:glx2k
ID: 6253576
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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question