473,396 Members | 1,766 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Error while running createdb from a batch file in windows xp

Hi,

I am installing postgreSQL 8.2 using batch files in windows xp machine.

I am installing postgres using postgresql-8.2.msi installer.
Installation was successful.

When i tried to run createdb command
using the following command from another batch file
"createdb -U dbname username"

command prompt asked me to enter password for the username

Is there a way to avoid this password prompt.

This command works good in windows 2000

Thanks in Advance,
Anand
Aug 17 '07 #1
5 8168
michaelb
534 Expert 512MB
Unless you set up your database access with the "trust" option this prompt is probably asking for your password, not the password for the username you passing to the createdb command.

Look at pg_hba.conf file, or simply run something like psql -l - would you be prompted for password?

If this is the case you can either change your access mode to trust instead of password, or put something like this in your batch file:
set PGPASSWORD=my_password

Obviously you may need to consider the possible security issues arising from these actions.
Aug 18 '07 #2
michaelb
534 Expert 512MB
And by the way, the code snippet for createdb command you posted is incorrect:
>> createdb -U dbname username
The correct format is
createdb -U username dbname
so make sure you call it correctly. Try "createdb --help" for more info.
Aug 18 '07 #3
Thanks Michael.

You guessed it right.

I changed the line in pg_hba.conf file from

host all all 127.0.0.1/32 md5
to
host all all 127.0.0.1/32 trust

and the problem got solved.

Sorry for the mistake i made in createdb syntax.
My batch file syntax was right. I quoted wrong to the forum.

Once again, Thank you very much...
Aug 20 '07 #4
michaelb
534 Expert 512MB
No problem, you're very welcome!
Aug 20 '07 #5
I'm pleased to confirm that the solution of adding

set PGPASSWORD=my_password

to your .bat file works fine, too. Thanks for the tip!

~ Ken
Jan 13 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
5
by: Patrice FRITSCH | last post by:
I'm trying to run a batch file from an asp page using WScript.Shell object. Dim oWSH set oWSH= Server.CreateObject("WScript.Shell") call oWSH.Run("cmd.exe /c " & szCmd , 0, true) szCmd...
5
by: Ken Cox [Microsoft MVP] | last post by:
MS has posted this here: http://www.asp.net/faq/ms03-32-issue.aspx Fix for: 'Server Application Unavailable' Error after Applying Security Update for IE...
6
by: AlanS | last post by:
I have used Visual Studio for about 8 months. I have developed some ASP solutions. I had to get on with some other things and have not worked with ASP.NET for a couple months. In the meantime, I...
5
by: Martin Robins | last post by:
I have never dabbled with ASP.NET until now so be warned! I have created a web application with the single default form: WebForm1.aspx and when I try to display it I get this error. My...
8
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported...
3
by: Anony Mous | last post by:
Hi, I've run into a problem. I've had postgres V8 beta on my WinXP Pro machine for some time now, and it's been running great. Now, for some reason, I cannot issue any queries to the database...
0
by: -pb- | last post by:
Hi, I have developed a web site for my client on .net 2.0 framework using asp.net 2.0. This web site will be hosted on Windows 2003 server. Web application runs the batch file on the user...
1
by: johnyjj2 | last post by:
Hello! I've got web application created for MSSQL and IIS. There are two directories in this application - Scripts and WebSite. In Script there is file CreateDb.sql. I need to run it so that it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.