Solved

Oracle-database password

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 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

13 Experts available now in Live!

Get 1:1 Help Now