title: How to connect PostgreSQL installed on ubuntu using R
body: <p>I have installed the Ubuntu postgreSQL very quickly, using the following command,</p>
  <pre><code>$sudo apt install postgresql postgresql-contrib
  </code></pre>
  <p>And I login into the database using he following command,</p>
  <pre><code>$sudo -i -u postgres
  
  $psql
  </code></pre>
  <p>Then I create the table and index of my database in it. I can see that the database is correctly imported, and have index created, and the database is ready to go.</p>
  <p>But the problem is in the R program, I use the library(RPostgreSQL) to connect to the database, I have filled the connection details as follows,</p>
  <pre><code>connection &lt;- dbConnect(driver, dbname='testchr22', host='localhost', port=5432, user= 'postgres', password='')
  </code></pre>
  <p>But all the connection failed.</p>
  <p>But my problem is the database connection always have problems,  I didn’t set up the password, I don’t know what password should include.</p>
  <p>I have always encounter the following errors, forever, and don't know where I got it wrong.</p>
  <p>Error in postgresqlNewConnection(drv, ...) : RS-DBI driver: ()
  Calls: batchAnnotate -&gt; dbConnect -&gt; dbConnect -&gt; postgresqlNewConnection
  Execution halted</p>