Solved

Oracle-database password

Posted on 1998-11-10
4
173 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

733 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