# Storing Items in SQL Database usefull?

**URL:** <https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565>\
**Category:** Platform & Builds\
**Tags:** database, unreal-engine, question, items\
**Created:** [May 14, 2017, 10:39am UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565 "2017-05-14T10:39:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_b98fe31a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b98fe31a1](https://forums.unrealengine.com/u/anonymous_user_b98fe31a1)\
**Post date:** [May 14, 2017, 10:39am UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/1 "2017-05-14T10:39:43Z")

</div>

I am looking for the best way (Network & Security wise) to store Items from an inventory for example.  
The following idea came to my mind:  
Storing all the Items a Player has in a SQL Database running on a Server.  
So every time a player opens up the Inventory it would request all the items a Player has and fill the Inventory accordingly. Regarding Security issues this attempt would be rather safe. I am wondering if it makes sense to always contact the SQL Server when requesting Items.  
From a Network perspective it would be a lot traffic back and forth. Furthermore the Items could not be requested in time when there is a bad Internet Connection, this would result in an empty Inventory for a few MS / sec.

So is my attempt rather right or wrong?  
If wrong, how could I archive a balanced solution (Network & Security wise)?

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b98fe31a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b98fe31a1](https://forums.unrealengine.com/u/anonymous_user_b98fe31a1)\
**Post date:** [May 21, 2017, 8:45pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/2 "2017-05-21T20:45:12Z")

</div>

Does anyone have a tip on how to to this?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_705e34d1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_705e34d1](https://forums.unrealengine.com/u/anonymous_user_705e34d1)\
**Post date:** [May 21, 2017, 9:05pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/3 "2017-05-21T21:05:06Z")

</div>

Would it make more sense to get items from the Database when loading your player / starting a game but then hold onto a local copy? That way you can avoid having repeated calls to get the same set of items. If the player inventory changes you could update the database but probably wouldn’t have to copy over the entire thing.  
The SQL copy would still exist as the ‘master’ copy if you needed to check if the inventory items are still valid.

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [May 21, 2017, 10:15pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/4 "2017-05-21T22:15:28Z")

</div>

SQL server should not be accessed direcly as it’s very insecure, user would have access to data that it should not access for example. Most common practice is to use HTTP or other request protocol as a gateway access database data, appications make HTTP authntication and request and HTTP server chacks if user can access this data, access database to grab that data and then send that data back to user, same as typical scripted websites do, just insted of sending generated HTML, you only send back data in some data friendly format like or XML

---

<div class="post-metadata">

**Author:** ![Nachtmahr](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Nachtmahr](https://forums.unrealengine.com/u/Nachtmahr)\
**Post date:** [May 21, 2017, 11:28pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/5 "2017-05-21T23:28:15Z")

</div>

Or only Request from Dedicated Server and strip out any Code from the Client Version. Shadows Solution is fine if the Client is also the Server but than again cheating is pretty easy since the HTTP Server has no clue how to verify Actions made by the Game Server (Client can send what he wants) he does not know about ^^

(See Borderlands as Example, no dedicated Servers enables easy cheating)

---

<div class="post-metadata">

**Author:** ![Shadowriver](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Shadowriver](https://forums.unrealengine.com/u/Shadowriver)\
**Post date:** [May 21, 2017, 11:35pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/6 "2017-05-21T23:35:05Z")

</div>

He didn’t explain how his game work, so i answered his question directly. If game host run on server then the game server should access SQL, SQL readings will naturally sync up with client via replication.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_b98fe31a1](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_b98fe31a1](https://forums.unrealengine.com/u/anonymous_user_b98fe31a1)\
**Post date:** [May 29, 2017, 6:34pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/7 "2017-05-29T18:34:23Z")

</div>

Thanks a lot! That was helpfull 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_3da1d5cd](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_3da1d5cd](https://forums.unrealengine.com/u/anonymous_user_3da1d5cd)\
**Post date:** [April 19, 2020, 6:56pm UTC](https://forums.unrealengine.com/t/storing-items-in-sql-database-usefull/393565/8 "2020-04-19T18:56:22Z")

</div>

I’m also dealing with this thematic long time … °\_^ In the past I used encrypted sqlite database (sqlcipher from zetic).  
I wonder If i can patch it into an UE4 Game … The Key for the db could be stored on server-side and requested via TLS/HTTPS.

Its always problematic to have local db-files, since rooting handys is possible and items in inventory could be manipulated.

I’m thinking of old diablo2 (patch 1.09) times… people cracked so much in closed [battle.net](http://battle.net) =)))
