tomoakin / RPostgreSQL

Automatically exported from code.google.com/p/rpostgresql
64 stars 20 forks source link

How to pass binary_parameters="yes"? #122

Closed dcaud closed 2 years ago

dcaud commented 2 years ago

I'm running out of connections on a postgresql database. I'm using library(pool) to manage connections at the application level, but multiple apps are running and I'm thus running out of connections. I'm trying to implement connection pooling at the database level (on Digital Ocean).

But I'm also using prepared statements, which requires that the connection to the database include "binary_parameters="yes"".

How do I pass that to the connection string?

The below doesn't work (it produces Error: invalid connection option "binary_parameters"):

pool <- dbPool(
  RPostgres::Postgres(),
  host = "....ondigitalocean.com",
  port = 11111,
  dbname = "dbnae",
  user = "username",
  password = "pass",
  maxSize = 15,
  idleTimeout = 20 * 60 * 1000,
  binary_parameters="yes"
)

Finally, maybe connection pooling, plus libary(pool) in a shiny app, is not the right way to go. The big question is how do I get around the problem of connection refused b/c of exceeding the 22 connection limit on a database hosted at Digitial Ocean?

tomoakin commented 2 years ago

This issue appears to belong to RPostgres, another R interface of PostgreSQL. Their contact is: https://github.com/r-dbi/RPostgres/issues