Link to home
Start Free TrialLog in
Avatar of palphen
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.
 
ASKER CERTIFIED SOLUTION
Avatar of bozo7
bozo7
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of palphen
palphen

ASKER

Nope, sorry, this doesn't seem to work in my case. The application compiles perfectly with the database-object and the parameters filled like you said. I can activate tables and queries without any problem in design-mode. But I am still prompted for a password when I run the executable.
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?
 
 
Avatar of kretzschmar
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(Database: TDatabase;
     LoginParams: TStrings);
{The Event OnLogin from TDataBase}
begin
  LoginParams.Values['USER NAME'] := 'YourUserName';
  LoginParams.Values['PASSWORD'] := 'YourPassWord';
end;

procedure TForm1.BitBtn1Click(Sender: TObject);
begin
  {Connect Now}
  database1.connected := true;
  table1.open;
end;

good luck on the try

   Meikl
Avatar of palphen

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