-2

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

6
  • It depends. Do you want to use hand made queries, micro ORM, ORM, ...? Commented May 25, 2021 at 8:58
  • Hand made @Klamsi Commented May 25, 2021 at 8:59
  • Npgsql maybe? Commented May 25, 2021 at 9:12
  • @Fliburt thanks, i want to check it out. however, i do not know yet how to make it work with VS Code + Ubuntu Commented May 25, 2021 at 10:33
  • Ok, i used this stackoverflow.com/questions/40675162/… to install nuget and (using nuget) npgsql Commented May 25, 2021 at 10:39

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.