The online racing simulator
Running PostgreSQL?
(8 posts, started )
#1 - Jakg
Running PostgreSQL?
Really stupid question...

Learning SQL at Uni, they are using PostgreSQL. Theres a shortcut in the start menu to open the database server, from that point I just type "psql postgres User" in CMD and I have command line access to the database.

I want to do the same to on my laptop... I've downloaded the installer for Postgres (version 9 x64), but I cant seem to find a way to start the database. If try any psql commands in CMD it just says it's an unrecognized command, and nothing to do with SQL is listed in environmental variables.

What can I do to get it working?
It's not like I can be of any real help here, but you could take a look at the shortcut you have on your Uni machines. It probably initiates a connection to the DB server and modifies $ENV so that you can use CMD to get access to the DB.
Add the folder containing the database daemon to your PATH env. var? Or type the full path to the executable in your the command line.
#4 - Jakg
Quote from MadCatX :It's not like I can be of any real help here, but you could take a look at the shortcut you have on your Uni machines. It probably initiates a connection to the DB server and modifies $ENV so that you can use CMD to get access to the DB.

Too locked down to view what the shortcut does...
Quote from thisnameistaken :Or type the full path to the executable in your the command line.

Worked in the end, once I worked out where the exe actually was...
#5 - amp88
Quote from Jakg :Too locked down to view what the shortcut does...Worked in the end, once I worked out where the exe actually was...

Adding the folder where the exe is to your PATH environment variable should let you just use "psql ..." from command line in any location.
#6 - Jakg
Quote from amp88 :Adding the folder where the exe is to your PATH environment variable should let you just use "psql ..." from command line in any location.

Any steps on how to do that? I already have a "path" variable, with some commands in it:

%CommonProgramFiles%\Microsoft Shared\Windows Live

The SQL launcher is this:

"C:\Program Files\PostgreSQL\9.0\bin\psql.exe" -h localhost -U User -d postgres -p 5432

How can I put it all together so when I am in CMD and i type "psql" it just works?
Paths in the PATH env. var should be separated by semicolons, so just add a semicolon to the end and then add the folder path to your database daemon (just the folder path not the executable).

But TBH if you're starting it from a shortcut with a bunch of args then there's not much point in adding it to your PATH.
#8 - amp88
Quote from thisnameistaken :Paths in the PATH env. var should be separated by semicolons, so just add a semicolon to the end and then add the folder path to your database daemon (just the folder path not the executable).

Do this ^

Then, create a new file in the same directory as your psql executable. Put your run command in it:

psql -h localhost -U User -d postgres -p 5432

Save it as "runpsql.bat". Now you should be able just to type in "runpsql" from any location and it will run your bat file (which will launch psql with your specified parameters).

Running PostgreSQL?
(8 posts, started )
FGED GREDG RDFGDR GSFDG