How to connect to PostgreSQL in Erlang using epgsql driver?

89 visualizações
Pular para a primeira mensagem não lida

S Sai Prasad

não lida,
27 de mar. de 2021, 02:23:3027/03/2021
para Erlang epgsql Postgres driver use and development
Hello epgsql team,
I would to like access the PostgreSQL database using Erlang.I tried using `connect` function but I am getting an error in console.Please provide me the solution to the problem.
ERROR MESSAGE:
** exception error: undefined function epgsql:connect/1
     in function  example:demo/0 (example.erl, line 5)
epgsql.png

Sergey Prokhorov

não lida,
27 de mar. de 2021, 22:11:2127/03/2021
para Erlang epgsql Postgres driver use and development
Hi.

Do you use rebar3 as a build tool?

суббота, 27 марта 2021 г. в 07:23:30 UTC+1, spr...@manufacanalytics.com:

S Sai Prasad

não lida,
28 de mar. de 2021, 11:29:1528/03/2021
para Erlang epgsql Postgres driver use and development
Yes

Sergey Prokhorov

não lida,
28 de mar. de 2021, 21:18:0328/03/2021
para Erlang epgsql Postgres driver use and development
Well, then make sure your project has

{deps, [epgsql]}.

and start erlang shell as `rebar3 shell`, not just `erl`
воскресенье, 28 марта 2021 г. в 17:29:15 UTC+2, spr...@manufacanalytics.com:

Sergey Prokhorov

não lida,
28 de mar. de 2021, 21:18:3928/03/2021
para Erlang epgsql Postgres driver use and development
{deps, [epgsql]}.  in rebar.conf file

понедельник, 29 марта 2021 г. в 03:18:03 UTC+2, Sergey Prokhorov:

S Sai Prasad

não lida,
30 de mar. de 2021, 03:38:2630/03/2021
para Erlang epgsql Postgres driver use and development
Hello Sergey,Problem resolved."rebar3 shell" worked.Thank you.

How to insert values into the table such that values are from function parameters?
Please check attached picture given below

insert_doubt.PNG


Сергей Прохоров

não lida,
30 de mar. de 2021, 10:55:5730/03/2021
para S Sai Prasad, Erlang epgsql Postgres driver use and development
Use `equery`, not `squery` when you need to attach dynamic data to your query:

```
epgsql:equery(C, "insert into mqtt_msg (topic, payload) values ($1, $2), [MqttTopic, MqttPayload])
```

вт, 30 мар. 2021 г. в 09:38, S Sai Prasad <spr...@manufacanalytics.com>:
--
You received this message because you are subscribed to a topic in the Google Groups "Erlang epgsql Postgres driver use and development" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/epgsql/6u_rdRrrC_s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to epgsql+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/epgsql/c99df749-70e2-48a0-bb1c-ddc965c069c8n%40googlegroups.com.
Responder a todos
Responder ao autor
Encaminhar
0 nova mensagem