Solved

heterogeneous JOIN

Posted on 2001-07-03
7
504 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
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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now