Dedicated web hosting - 612 CHAPTER 27 THE MANY POSTGRESQL CLIENTS
612 CHAPTER 27 THE MANY POSTGRESQL CLIENTS general queries such as table selections and insertions, and do much more. In this section, you ll learn about the many features at your disposal when using this terse yet powerful client. psql Options The psql utility is executed from the command line by executing the psql command generally alongside one or several options. Its prototype looks like this: psql [option…][dbname [username]] At a minimum, you need to pass along the dbname and username parameters if these values aren t stored within the .psqlrc configuration file or specified within certain global variables (see the later section Storing psql Variables and Options ). Therefore, to connect a user website to the database corporate found on the PostgreSQL server located on IP address 192.168.3.45, you d execute the following command: %>psql -h 192.168.3.45 corporate website To see the other syntax variations for this task, see the section Logging Onto and Off the Server, later in this chapter. In most cases, these three parameters are all that you will require for typical operations (unless you re connecting locally, meaning the host address won t be required), but you may occasionally wish to pass along various options that will affect psql s behavior. The most commonly used options are presented in Table 27-1. Table 27-1. Common psql Client Options Option Description -c COMMAND Executes a single command and then exits. -d NAME Declares the destination database. The default is your current username. -f FILENAME Executes commands located within the file specified by FILENAME, and then exits. -h HOSTNAME Declares the destination host. –help Shows the help menu and then exits. -l Lists the available databases and then exits. -L FILENAME Sends a session log to the file specified by FILENAME. -p PORT Declares the database port used for the connection. The default is 5432. -U NAME Declares the connecting database username. The default is the current username. -X Does not read the system-wide or user-specific startup file (psqlrc or ~/.psqlrc, respectively). Although manually passing these options along is fine if you need to do so only once or a few times, it can quickly become tedious and error-prone if you have to do so repeatedly. To eliminate these issues, consider storing this information in a configuration file, as discussed in the later section Storing psql Variables and Options.
If you are in need for chaep and reliable webhost to host your website, our recommendation is http web server services.