I wrote a web app, using java + spring+ PostgreSQL, which I have up and running.
I have a tester for my system and I want him to be able to connect to my database directly to check the result of interaction with application. As always, the web is littered with articles on how to connect, but one simple thing they don't mention is whether a client should install some app to connect to the database? I get the bit about making correct settings for the database, but if a mere mortal enters the following in their windows console:
psql -h <host> -p <port> -u <database>
they will get 'psql' is not recognized as an internal or external command, operable program or batch file. I understand I don't get that error because I operate via shell and my home path is set to psql.exe, but again the client doesn't need to install PostgreSQL to access remote a PostgreSQL database. It just doesn't click in my head.
How can a client connect to database via command prompt without installing anything?
3 Answers 3
I suppose the simplest way is to let the tester use ssh
to login to your server. Then the tester's execution environment is whatever your server exposes through the shell. (I presume that would include psql
.)
As far as I know, all modern Unix derivatives install ssh by default. That would include Linux, Solaris, OS/X (Apple), and BSD. I believe that Windows does not ship with ssh, but Cygwin and PuTTY are commonly used to remedy that problem.
Though not as system-agnostic as shell access, if the tester happens to use a system in the Debian/Ubuntu family, the postgresql-client package should install what they need. I don't know what pre-packaged options might be available to install stand-alone psql on other platforms.
You need to check that psql is in their $PATH - or provide the full path to psql when executing it.
pg_hba.conf
to ensure that the server is accessible. Also,psql.exe
needs to be on thePATH
. This can be obtained from postgresql.org and downloaded from the "advanced" binaries download (no installer).