Solved

Oracle-database password

Posted on 1998-11-10
4
172 Views
Last Modified: 2010-04-04
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.
 
0
Comment
Question by:palphen
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
bozo7 earned 100 total points
ID: 1346383
Use a TDatabase Object
The Databasename property is what all of your TTables and TQueries will use for the Databasename.
In the parameters of the TDatabase object add the following lines:

USER NAME=MYUSERNAME
PASSWORD=MYPASSWORD

set the login property to false.
This is what I do. It works great.
Bozo
0
 

Author Comment

by:palphen
ID: 1346384
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?
 
 
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 1346385
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
0
 

Author Comment

by:palphen
ID: 1346386
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
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

829 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