Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8511651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:03:51+00:00 2026-06-11T04:03:51+00:00

Using Delphi how can you find out of the psql script has returned password

  • 0

Using Delphi
how can you find out of the psql script has returned

   password authentication has failed for user "myadmin"

when running the following script(psqlRun.bat)

   "C:\Program Files\PostgreSQL\9.0\bin\psql.exe"  -h localhost -p 5433 -d TestDB -U myadmin -f someSQLscript.sql   

The above script was ran using shellexecute

   ReturnedValue:= ShellExecute(Handle,'open',PChar('C:\psqlRun.bat'), nil, nil, SW_SHOWNORMAL);

The returned value was over 32 (so it ran successfully)
but for me the password authentication failed..
is there any way to find through delphi is the script failed if the password failed?
Since the pgpass.conf may not have been created so i cant check the file for user password.
The user may not know the password or may have entered wrong password.

so programmatically how to check if the authentication failed?

Note : Postgresql 9.0

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:03:53+00:00Added an answer on June 11, 2026 at 4:03 am

    the returned value was over 32 (so it ran successfully)

    No, it does not mean it. http://msdn.microsoft.com/en-us/library/windows/desktop/bb762153.aspx
    It only means it had STARTED successfully. If the complete run was successful or not, MSDN hints there is no way to know using ShellExecute/ShellExecuteEx.

    You should use CreateProcess to get running task handle, then WaitFor to get result or intercept it’s output to look for particular lines.

    You can try Jedi Code Library, where JclSysUtils unit has Execute function and TJclCommandLineTool class to incapsulate this.
    Example of use is JCL installer, which calls a number of command-line utils, like DCC32.EXE, capturing and saving their output to log and checking the return codes.

    PS. And you’d better not using bat file for it. Make command line and run it directly. As of now you make it a tree.

     YourProg.exe
     \\-> CMD.EXE /C BAT-FILE-NAME
          \\->pgSQL exe with options
    

    Even if pgSQL.exe returns something, it does not return to your program but to CMD.exe
    After that CMD.exe exposes that code into its internal variable %ERRORLEVEL%
    And now you have to learn if it can pass that variable outside for your program.

    Why that ? Every next indirection level make your program more isolated and fragile. Just call PG EXE directly without scripts. Otherwise you should program for CMD.EXE also – do you really need it ?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working in Delphi 2007. Net, where I can find an example of using
I'm using Delphi 2009. My program has been compiling and running fine. I use
Using the RTTI system in Delphi 2010, is there any way to find out
How can I check using Delphi 2007 that a box is AVX capable. My
How can I detect all WiFi networks availables using Delphi? (source: filebuzz.com )
How i can parse and extract the parameters from an SQL Query using delphi?
I want to monitor the copy file function using Delphi. I can do it
How i can declare a global method in delphi prism using the __Global class?
In Delphi 2009, how can I build a project using command line. I tried
I'm using Delphi 7 and can't predict the target version of Windows. I need

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.