Question

How to connect Unity to Postgresql database?

I am trying to connect my Unity game to a database I have, however, I’m not sure how I can send a request to it. It’s code that will only be on the server, so I want to write C# code to retrieve data from the database.

I’m also confused as to how I would create new tables. Do I have to use the console the database is assigned to and somehow send SQL commands to create tables that way? I’m not sure because I’m new to this, so any help would be appreciated!


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Hi @galactichyperstar,

I’ll recommend you to check the following:

Getting Started with DigitalOcean Managed Databases for PostgreSQL Youtube Video

Just how managed are DigitalOcean’s Managed Databases and how to use them :

https://www.digitalocean.com/blog/just-how-managed-are-digitaloceans-managed-databases/

and the most important one the documentation:

https://docs.digitalocean.com/products/databases/

Basically, you’ll be able to connect to your database and execute commands like CREATE/UPDATE/DROP etc.