Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Issue Connecting Unity Standalone to SQL Server

Discussion in 'Multiplayer' started by Cookn5, Apr 5, 2019.

  1. Cookn5

    Cookn5

    Joined:
    Jun 27, 2018
    Posts:
    2
    I am trying to connect my Unity Standalone Application to an Azure SQL Server and am having some issues. I have read multiple posts on this forum and others, but am unable to figure it out. Most posts reference the System.Data.SqlClient dll. I downloaded the NuGet package, extracted the files, and placed the .netstandard 2.0 dll in the Plugins folder located under Assets. I am receiving the following error:

    PlatformNotSupportedException: System.Data.SqlClient is not supported on this platform.
    System.Data.SqlClient.SqlConnection..ctor (System.String connectionString) (at <5fa23ac5b8744138a73ff29c4993213c>:0)
    (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlConnection..ctor(string)
    SQLConnectionTest..ctor () (at Assets/Scripts/SQLConnectionTest.cs:12)

    After searching exhaustively for a solution to this I am still at a loss. My Unity version and build settings are:

    Unity Version: 2018.3.10f1
    Scripting Runtime Version: .NET 4.x Equivalent
    Scripting Backend: Mono (I have tried changing to IL2CPP with no luck)
    Api Compatibility Level: .NET Standard 2.0

    Does anyone know how to fix this? Or if I am taking the wrong approach, how to connect a Unity Standalone build to a SQL server?

    Note: I have seen many people comment other similar posts about why you would need a database and why not just PlayerPrefs. I am currently only using Unity for the UI capabilities and users changes need to be stored in a SQL database so some of the other components of my project can access it. I know there are better options out there for developing a UI, but I plan on integrating VR capabilities for the HoloLens in the future which is why I am using Unity.
     
  2. unity_foJiD5BysUE2pQ

    unity_foJiD5BysUE2pQ

    Joined:
    May 6, 2019
    Posts:
    1
    @Cookn5 did you find a solution to this problem?
    I am currently working on a Digital Twin and I have the same issue with MS SQL