# LibPQ on the Raspberry PI

**URL:** https://discourse.julialang.org/t/libpq-on-the-raspberry-pi/118282
**Category:** General Usage
**Created:** [August 16, 2024, 4:37pm UTC](https://discourse.julialang.org/t/libpq-on-the-raspberry-pi/118282 "2024-08-16T16:37:14Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)
#### Post date: [August 16, 2024, 4:37pm UTC](https://discourse.julialang.org/t/libpq-on-the-raspberry-pi/118282/1 "2024-08-16T16:37:14Z")

</div>

I have LibPQ working on a Windows machine. I am now trying to get it to work on a Raspberry PI 4. The RPI has 64 bit bookworm installed as Raspberry PI OS. It is up to date.

I installed Postgresql using the installation instructions at this [site](https://pimylifeup.com/raspberry-pi-postgresql/). This includes the installation instructions and the instructions for setting up the CLI.

Then going to a discourse discussion I included the steps on this discourse [post](https://discourse.julialang.org/t/not-able-to-load-postgresql-into-libpq-jl/68767/8).

When I type in either of the commands

```julia
conn = LibPQ.Connection("dbname=postgres")
conn = LibPQ.Connection("dbname=postgres user=jakez")

```

I get this error message

```julia
[error | LibPQ]: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
ERROR: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory
        Is the server running locally and accepting connections on that socket?
Stacktrace:
 [1] error(logger::Memento.Logger, exc::LibPQ.Errors.PQConnectionError)
   @ Memento ~/.julia/packages/Memento/xnHxE/src/loggers.jl:463
 [2] handle_new_connection(jl_conn::LibPQ.Connection; throw_error::Bool)
   @ LibPQ ~/.julia/packages/LibPQ/CRtC5/src/connections.jl:127
 [3] LibPQ.Connection(str::String; throw_error::Bool, connect_timeout::Int64, options::Dict{…}, kwargs::@Kwargs{})
   @ LibPQ ~/.julia/packages/LibPQ/CRtC5/src/connections.jl:0
 [4] LibPQ.Connection(str::String)
   @ LibPQ ~/.julia/packages/LibPQ/CRtC5/src/connections.jl:265
 [5] top-level scope
   @ REPL[4]:1
Some type information was truncated. Use `show(err)` to see complete types.

I am not sure what to do next.

```

---

<div class="post-metadata">

### Author: ![Jake](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jake/32/46007_2.png) [@Jake](https://discourse.julialang.org/u/Jake)
#### Post date: [August 20, 2024, 12:17am UTC](https://discourse.julialang.org/t/libpq-on-the-raspberry-pi/118282/2 "2024-08-20T00:17:44Z")

</div>

Found the problem. Postgres tends to be case insensitive, but the database name must be in lower case for the RPI, where it does not need to be for windows. I also needed to add the port and host to the DBInterface.connect command. The example is:

```julia
Works for Windows
dbread = "Test2"
DATABASE_USER = get(ENV, "LIBPQJL_DATABASE_USER", "postgres")
DATABASE_PASSWORD = Password
conn = DBInterface.connect(FunSQL.DB{LibPQ.Connection}, 
"dbname=$dbread user=$DATABASE_USER password=$DATABASE_PASSWORD")

Changes for RPI
dbread = "test2"
conn = DBInterface.connect(FunSQL.DB{LibPQ.Connection}, 
"dbname=$dbread user=$DATABASE_USER password=$DATABASE_PASSWORD
host=localhost port=5432")

```
