How to connect to Postgres db with Unity/C#? How to execute queries? I have Postgres db on Heroku server (not localhost) and was able to work with it via python and psycopg2 but now i use Unity. I have all db credentials. Just do not know which library to use and how to install it. I use Ubuntu and VS Code. I installed Nuget and Npgsql via Nuget but its classes are not visible in VS Code for some reason
Asked
Active
Viewed 240 times
-2
-
It depends. Do you want to use hand made queries, micro ORM, ORM, ...? – Klamsi May 25 '21 at 08:58
-
Hand made @Klamsi – Bohdan Z. May 25 '21 at 08:59
-
[Npgsql](https://www.npgsql.org/) maybe? – Filburt May 25 '21 at 09:12
-
@Fliburt thanks, i want to check it out. however, i do not know yet how to make it work with VS Code + Ubuntu – Bohdan Z. May 25 '21 at 10:33
-
Ok, i used this https://stackoverflow.com/questions/40675162/install-a-nuget-package-in-visual-studio-code/47856617 to install nuget and (using nuget) npgsql – Bohdan Z. May 25 '21 at 10:39
-
But there are many versions of npgsql. i have tried to install some, but classes are not accessible. – Bohdan Z. May 25 '21 at 11:28
1 Answers
0
I found Npgsql.dll on dllme.com. I put it to Plugins folder that I created in Assets in Unity. That gave me some errors: Npgsql needed some dlls. I followed them and found those dlls on dllme.com and put them to Plugins also. And continued until there will be no errors. And it works now on my Ubuntu with local PostgreSQL DB. I have 5 dlls in Plugins: Npgsql, System.Buffers, System.Memory, System.Runtime.CompilerServices.Unsafe, System.Threading.Tasks.Extensions

Bohdan Z.
- 19
- 5