palphen
asked on
Oracle-database password
When I start the application, I'm prompted for my username and password for access to the Oracle-database that's on a server.
How do I avoid this? My application has it's own password-system, and the customer doesn't like having to enter two passwords/usernames when starting the application.
"TSession.AddPassword" doesn't seem to work.
How do I avoid this? My application has it's own password-system, and the customer doesn't like having to enter two passwords/usernames when starting the application.
"TSession.AddPassword" doesn't seem to work.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi palphen,
this should work at runtime of your application
use the TDatabase Component,
give on the Property DataBaseName a name
give on the Property AliasName the Name of the Alias you want to use
on the TTable(s) and/or TQuery(s) Components you use the Property DataBaseName
should have the same entry as TDataBase.DataBaseName.
Now you can use Following code :
procedure TForm1.Database1Login(Data base: TDatabase;
LoginParams: TStrings);
{The Event OnLogin from TDataBase}
begin
LoginParams.Values['USER NAME'] := 'YourUserName';
LoginParams.Values['PASSWO RD'] := 'YourPassWord';
end;
procedure TForm1.BitBtn1Click(Sender : TObject);
begin
{Connect Now}
database1.connected := true;
table1.open;
end;
good luck on the try
Meikl
this should work at runtime of your application
use the TDatabase Component,
give on the Property DataBaseName a name
give on the Property AliasName the Name of the Alias you want to use
on the TTable(s) and/or TQuery(s) Components you use the Property DataBaseName
should have the same entry as TDataBase.DataBaseName.
Now you can use Following code :
procedure TForm1.Database1Login(Data
LoginParams: TStrings);
{The Event OnLogin from TDataBase}
begin
LoginParams.Values['USER NAME'] := 'YourUserName';
LoginParams.Values['PASSWO
end;
procedure TForm1.BitBtn1Click(Sender
begin
{Connect Now}
database1.connected := true;
table1.open;
end;
good luck on the try
Meikl
ASKER
Thanx Bozo and Kretzschmar!
Turns out you are both right.
When it didn't work the first time (when I tried Bozo's solution), it didn't work because I forgot to change the database-name for 1 query-component on one of my (many) screens (sorry 'bout that).
When the application created this last screen, it started looking for a Database with a slightly different name, and naturally asked for a password.
The two ways to fill the database-parameters you mentioned both work.
Bozo, you got it right the first time: you get the points.
Greetings,
Pascal
Turns out you are both right.
When it didn't work the first time (when I tried Bozo's solution), it didn't work because I forgot to change the database-name for 1 query-component on one of my (many) screens (sorry 'bout that).
When the application created this last screen, it started looking for a Database with a slightly different name, and naturally asked for a password.
The two ways to fill the database-parameters you mentioned both work.
Bozo, you got it right the first time: you get the points.
Greetings,
Pascal
ASKER
I then changed the creation-order for the non-visual components, so the database-component would be created first; I thought maybe some table or query was created before the database, and that triggered the login-screen. But this didn't help.
Could it be that it's the Oracle-server that doesn't accept the database-object-workaround