MS SQL Integration for UE4

Bringing the Power of C#.NET in UE4

**Marketplace link : https://www.unrealengine.com/marketplace/ms-sql-integration
**

Hi Guys ,

Since my C++ knowledge is restricted to Unreal C++ and not having any basic concepts of core C++ , it has always occurred to me what if I can write gameplay actions in C++ and blueprints , but all non gameplay tasks are carried out by C#. Having expert knowledge and experience in C# , I believe I can do pretty much anything if only I have access to C#. Well , last year I found out that, it is very much possible.

The MS SQL Integration Plugin brings the power of .Net in Unreal Engine. With this plugin you can store and retrieve data and images from your SQL Server. Build your own queries and select and update data to your database directly from Blueprints. No restrictions in query formation. Any query working inside SQL Client , works here, which means you can select and update multiple data at once , use joins and sub-queries, as well as create and drop tables via Blueprints.

This thread will be used for support so post any queries or feedback related to this plugin here.

Hey, Sameek.

Just wanted to let you know that I am highly satisfied with your plugin. I am able to already do a read/write interface to my Azure and LocalDB (Express) databases (but read-only to my third device), and have prototyped my final read/write interfaces into my blueprints for machine control. It is actually a project consisting of two gateways: 1) a gateway to my SQL Servers from Unreal (your plugin does nicely), and 2) a .Net gateway to the Modbus/TCP protocol, an industry-standard industrial protocol for machines.

I just wanted to tell you that I was able to take apart your widgets in a straightforward way, and I am glad you have some decent documentation on some of the challenges facing SQL Server. Before I became an industrial engineer, I was a SQL database administrator, so your plugin is a natural fit. Interestingly, industrial programmers tend to use function blocks, just like Unreal Engine - it is part of our industry-standard programming interface (IEC 631131). My .Net program needed some threading to get it to work well with SQL Server, so I am glad that you decided to use C++ for the Unreal arrangement: it helped me there, too.

I am just getting started with Unreal, and have watched many tutorials to determine that I wanted to use it. I am working on a game for a celebrity team, too, and am the builder of all assets. I have been learning Widget UMG UI to bridge between my apps (at build-a-gizmo.com), and Unreal widget blueprints. I have been learning how to deal with construction and level blueprints during the “nativization” stage of compile in this engine, so I can get good performance out of my SQL gateway. Basically, I want to be able to build virtual 3D models of machines, and move them interactively via the actual machine’s data. A bit like AutoCAD with event logic.

My project is to build a “general purpose” HMI (UI) for industrial control panels. Your plugin is stellar. Thanks, again.

Cheers,

Hey,
It is really good to know that your have liked it.

Can this do more complex queries? like for example: “Select * from Users where UserID = @ID and activeChars > ‘0’”
Also will it run the Update command? I saw you have an example of the insert. So " update Users set Firstname=@first, Lastname=@last where UserID = @ID;"

Yes sir. Form the query string , and pass it to Select , Insert and Update your database. Any complex query works , the important part is correctly forming the query. To use data manipulation commands like insert , update , delete , create , drop , etc, you do it in the same way , form the respective query and pass it to the function “Update Data from Query”

Awesome. Thanks

How is the performance? Allot of sql plugins seem to fall short once some 20-50 actors try to “save” their data at once since they are all using gamethread…

Performance depends on the server speed. However I researched on asynchronous data select and update recently and it has been implemented to my Mysql plugin released today. Thanks for the suggestion, will be able to update the ms sql plugin to support asynchronous.

I have a little trouble with the SQL Server Authentication.I can connect with HeidiSQL on TCP 1433 but when I use Set Connection Properties from UE4 project I always get Login failed.The Login is from an untrusted domain and cannot be used with Windows Authentication.SQL Express is setup to use mixed mode, the login/user the same and has all the rights and roles needed.Firewall is down (using Virtual Box).Can anyone give me a hint on what can be wrong?

forum question came in. Here my answe, if it helps anyone…

I have not made a video of specifically that plugin, but I have made videos and tools for SQL Server (I’m a Microsoft Partner). Search for Pete Schieck on YouTube. Anyway, I spent some time, but not a lot, with Sameek’s plugin, to prove to myself that it works. I build industrial equipment that can now talk to Unreal (build-a-gizmo.com, we are NOT a big company, we’re just a couple guys)…

anyway, the plugin does work, but it’s hard to find the blueprints that Sameek uses in his sample files. I just needed to see if I could change one of the values he was sending in the query, you know? So, I found the blueprint that did that, and changed the value. You have to do something in Unreal to show all blueprints, because it doesn’t show in the regular blueprint query.

Then, the connection string was the big one. I have been doing connection strings for many years, but it’s alwsts hard, because programmers and companies don’t tend to show fundamentals.

So, I messed around to find my local SQL Express connection string, usually by running a blank .udl file, in Windows. You just make a text file, change extension to .udl, double-click (some versions, you right-click and choose OLE …) on it. Then, you choose your database source, close it. Then, you ‘edit’ the text file (change it back to .txt), and it will have the connection string in it! Weird Microsoft trick.

Put that in the connection string parameter in Sameeks blueprint, and it works. I have a comment in the thread that shows samples for localdb and Azure SQL Servers.

Ask me anything. I’ll see if I can help.

  • peace

Thank you for your answer, I saw the PM first so I replied there.I will post my findings here so maybe can help others.The example widget blueprints are in the installation folder of the plugin (ue4 engine path/engine/plugins/marketplace/MSSQL/content)and they do work. My problem was that i tried to use “Set connection properties” from any other place than widget blueprint.I just bought this plugin so in the near future I will post anything that could be helpful.

This plugin can be used to store entire actor with your variables or entire level with you actor and variables. Save all the world or actor as objects???

Yes , but it is easier to create savegame object for this purpose first , and then if you want you can store your save game text file as byte array in your database.

if I type "exec ‘sp_spaceused’ " will I get results ?

Yes definetely. Any syntax which works in the SQL client will work here.

Hi, I find that if the server I’m trying to connect to does not exist or is not reachable, Unreal crashes.
Is there perhaps a way to make the plugin fail in a safe way?
Perhaps add a “Connection Success” Boolean as an output node? A fail dialogue node can also be very useful…i.e. help to determine if it war the server credentials or user credentials which caused the connection failure.

Hey. The Set Connection Properties does check the connection failure state as well. We check its status in tick event as it performs the operation async, and only proceed to reading or writing the data to the server, when a connection is successful. The function Check Connection State is there for this purpose.

Feeling a little stumped as to what I’m doing wrong… connection to SQL gets established when the login level loads up, widget gets created and any errors do get reported back properly through printstring from the query nodes. I’ve checked the data table in MSSM and it only has null entries since nothing has been added yet, the code is returning an = to any account name entered and flagging “AccountNameIsInUse?” as true.

???

Hey,

The Query looks fine, so in this case I would suggest try the UpdateQueryAsync method first. Also you can check out with example WIdgets present in the Plugin Content Directory.

To follow up, the way I got the code to work was to change the “get” node to a “contains” and then store the array index as a variable and use that variable for the get node when checking the password against the account name. Everything works after doing that! shrug