1

We have spent more than a couple of days on this have gone though almost all available threads online but nothing has worked so far.

We are using Unity Version 2019.2.1 and Visual Studio 2019 Community Edition.

We have already tried the following:

  1. We have tried using Entity Framework model using both ObjectContext and DataContext and in both ways the app.config file and .edmx file are lost when we reload the solution

  2. We have also tried using legacy SqlConnection using System.Data and System.Data.SqlClient namespaces by copying the dlls into the Plugins folder

We have checked and double checked all SQL Server configurations, ports, authentication, etc. and use SQL Server on day-to-day basis for our other projects.

Can someone please point to any working sample / example / video / article on how to access data from Microsoft SQL Server in Unity3d?

Thanks in advance!

Regards, Swapneel Shah

3
  • 1
    Sorry but I don't think it is a good idea to connect DB from the CLIENT directly. It is not bad practice it is the worst practice.Try to Create API(WCF,ASP or any other) and make calls to that api which will modify your db Commented Jan 31, 2020 at 6:33
  • Dear Phantasm, We need to pull huge amounts of data from MS SQL server that we need to used in Unity. Adding a layer above the database just for the sake of it does not make sense to me for the. Anyway, thank you for your kind suggestion. Regards. Commented Jan 31, 2020 at 7:07
  • Dear Muhammad Faizan Khan, thank you for the link, but we are specifically looking for MS SQL server connectivity. Regards. Commented Jan 31, 2020 at 7:08

1 Answer 1

1

Check this for Connect to MS SQL database:

https://forum.unity.com/threads/connect-to-ms-sql-database.484855/

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

2 Comments

Dear Jay, Thank you sharing the thread. We have already tried code that is similar on the thread. Though the code build in Visual Studio's C# compiler; the same code does not build with the Unity's C# compiler (both the compiler versions are different). Also, we see errors like references not matching, socket exception at run-time (though everything is configured and tested to work perfectly). Hence we are hoping to find some arrangement that is working for someone. Regards.
@Jay Rindani Please read the link - meta.stackexchange.com/questions/8231/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.