Solved

Connect to Oracle - UserID & Password.

Posted on 2001-07-12
7
285 Views
Last Modified: 2010-04-06
I've got a small application that connects to an Oracle Database via it's ODBC entry.  The only thing that's wrong with it is that it always prompts for a UserID and Password.

I want to hard-code these so the user does not receieve the prompt.  How do I do this?

MoonCalf.
0
Comment
Question by:MoonCalf
  • 4
  • 2
7 Comments
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
Hello

  you need to add database component, and change the property LoginPrompet to false

procedure TForm1.Button1Click(Sender: TObject);
begin
  with Database1 do begin
    Params.Values['USER NAME'] := 'Mohammed';
    Params.Values['PASSWORD'] := 'zzz';
    LoginPrompt := False;
    Connected := True;
  end;
  Table1.open;
end;

if you need the full project, email me at nasman@mogaza.org

Best regards
Mohammed Nasman
0
 
LVL 22

Accepted Solution

by:
mnasman earned 50 total points
Comment Utility
Hello

  you need to add database component, and change the property LoginPrompet to false

procedure TForm1.Button1Click(Sender: TObject);
begin
  with Database1 do begin
    Params.Values['USER NAME'] := 'Mohammed';
    Params.Values['PASSWORD'] := 'zzz';
    LoginPrompt := False;
    Connected := True;
  end;
  Table1.open;
end;

if you need the full project, email me at nasman@mogaza.org

Best regards
Mohammed Nasman
0
 
LVL 1

Author Comment

by:MoonCalf
Comment Utility
Thanks for the reply, but it's not relevant for me to add a database component, or any other for that fact.  I have created a component that creates the DSN and then creates a TQuery to connect to it so that I can execute SQL statements.

The first time I execute an SQL statement the window pops up asking for UserID & password.

Therefore, adding another component will not solve the problem as I can't connect to the database until the DSN has been created and this only happens after the component has been created.

Besides, I tried the code and it didn't work.

Thanks again,

MoonCalf.
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
you could create a tdatabase within your component
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
Hello

  I test my code and it's work fine with me, and I use it, also i test it with the ODBC driver and work fine
  but as i know you can't ignore the oracle login screen without using Database component

Mohammed
0
 
LVL 1

Author Comment

by:MoonCalf
Comment Utility
Sorry, my mistake.

It does work fine as long as I assure that the DB component is connected before I execute an SQL statement.

Thanks a lot,

MoonCalf.
0
 
LVL 22

Expert Comment

by:mnasman
Comment Utility
you are welcome :)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

763 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

6 Experts available now in Live!

Get 1:1 Help Now