Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by hygradme · Jun 21, 2019 at 09:34 AM · iosdatabaseil2cppsql

Connecting to SQL database from iOS app made by Unity fail with error

I try to store app usage log on SQL database of Azure.

My iOS app show an error when it connects to SQL server while debugging with Xcode and on iPad.

I bring System.Data.dll from Contents/MonoBleedingEdge/lib/mono/unityjit since without this, using System.Data.SqlClient; showed error.

Build on Unity and build and run on Xcode succeeded. When I call the function on iPad, the error appeared and cannot add record on database.

It seems like an error is caused by the following function since without this, the error disappear. Reading the error message, it looks some function I used is not available for il2cpp build but not sure how to cope with this error. Could you tell me how to debug this error?
Thanks.


script:

 using UnityEngine;
 using System.Data.SqlClient;
 
 public class LogDBCall : MonoBehaviour {
     public void InsertRecord(string person_name,  string device_id)
     {
         SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder();
             builder.DataSource = <server>;
             builder.UserID = <userid>;
             builder.Password = <password>;
             builder.InitialCatalog = <database>;
 
        SqlConnection connection = new SqlConnection(builder.ConnectionString);
 
             connection.Open();
         var command = new SqlCommand();
             command.Connection = connection;
             command.CommandText = @"INSERT INTO db_name(person_name, device_id ) VALUES 
                                     ('"+person_name+"','"+device_id+"' );";
 
         command.ExecuteNonQuery();
         connection.Close();
         }
     }


error Log:

 LogDBCall:InsertRecord(String, String, Int32, String)
 <Register>c__Iterator1:MoveNext()
 UnityEngine.SetupCoroutine:InvokeMoveNext(IEnumerator, IntPtr)
  
 (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/DebugBindings.gen.cpp Line: 51)
 
 NotSupportedException: /Users/builduser/buildslave/unity/build/External/il2cpp/il2cpp/libil2cpp/icalls/mscorlib/System.Reflection/Assembly.cpp(547) : Unsupported internal call for IL2CPP:Assembly::GetManifestModuleInternal - "This icall is not supported by il2cpp."
   at Bid.initEntryPoint () [0x00000] in <00000000000000000000000000000000>:0 
   at Bid+AutoInit..ctor () [0x00000] in <00000000000000000000000000000000>:0 
   at Bid.internalInitialize () [0x00000] in <00000000000000000000000000000000>:0 
   at Bid..cctor () [0x00000] in <00000000000000000000000000000000>:0 
   at System.Data.Common.DbConnectionStringBuilder.get_ConnectionString () [0x00000] in <00000000000000000000000000000000>:0 
   at LogDBCall.InsertRecord (System.String person_name, System.String device_id) [0x00000] in <00000000000000000000000000000000>:0 
   at Registration+<Register>c__Iterator1.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
   at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
 Rethrow as TypeInitializationException: The type initializer for 'Bid' threw an exception.
   at System.Data.Common.DbConnectionStringBuilder.get_ConnectionString () [0x00000] in <00000000000000000000000000000000>:0 
   at LogDBCall.InsertRecord (System.String person_name, System.String device_id) [0x00000] in <00000000000000000000000000000000>:0 
   at Registration+<Register>c__Iterator1.MoveNext () [0x00000] in <00000000000000000000000000000000>:0 
   at UnityEngine.SetupCoroutine.InvokeMoveNext (System.Collections.IEnumerator enumerator, System.IntPtr returnValueAddress) [0x00000] in <00000000000000000000000000000000>:0 
  
 (Filename: currently not available on il2cpp Line: -1)


My environment:

Unity version 2017.4 LTS and 2018.4 LTS Macbook Pro version 10.14.5 Xcode version 10.2.1(10E1001) iPad Pro 12.9 inch 3rd generation Configuration: .NET 4.x Equivalent IL2CPP .NET 4.x

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

144 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

IL2CPP error on Unity5 1 Answer

Is there a way to upload a Unity project to the App Store with Mono as scripting backend after 1st of June? 1 Answer

Can't Create MySqlCommand Object 0 Answers

Crossdomain policy trouble 1 Answer

WWW is returning Cannot connect to Destination host, when I know the host is reachable 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges