Solved

heterogeneous JOIN

Posted on 2001-07-03
7
519 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
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!

 

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

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.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses
Course of the Month7 days, 11 hours left to enroll

632 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