Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 kerebro · Dec 10, 2012 at 04:03 PM · cloudsqlencryption

Connecting to Azure SQL db with Unity 4.0

Hi all, I need to connect to an Azure SQL database and write some stuff, this is what I've been trying to do:

 using System.Data;
 using System.Data.Sql;
 using System.Data.SqlClient;
 
 ...
 
 public void saveToDB (string json)
 {
     string connectionString = "Server=tcp:wotsxsa994.database.windows.net,1433;" +
         "Database=db;" +
         "User ID=uid;" +
         "Pwd=pwd;" +
         "Encrypt=yes;";
         
     SqlConnection dbcon = new SqlConnection (connectionString);
     SqlCommand dbcmd = dbcon.CreateCommand ();
         
     dbcmd.CommandType = CommandType.StoredProcedure;
     dbcmd.CommandText = "INSERT INTO " + table + " VALUES (3, 433, 433, 1" + json + ")";
 
     object result;
     try
     {
         dbcon.Open ();
         result = dbcmd.ExecuteScalar ();
         Debug.Log (result);
         dbcon.Close ();
     }
     catch (System.Exception ex)
     {
         Debug.Log (ex);
     }
 }

Any idea what I might be doing wrong? This is what I get:

 NotImplementedException: SSL encryption for data sent between client and server is not implemented.
 System.Data.SqlClient.SqlConnection.SetProperties (System.String name, System.String value)
 System.Data.SqlClient.SqlConnection.SetConnectionString (System.String connectionString)
 System.Data.SqlClient.SqlConnection.set_ConnectionString (System.String value)
 (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlConnection:set_ConnectionString (string)
 System.Data.SqlClient.SqlConnection..ctor (System.String connectionString)
 (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlConnection:.ctor (string)
 Comm.saveToDB (System.String json) (at Assets/[TB] Script/General/Comm.cs:649)

I guessed it had something to do with the "Encrypt = yes" in the connection string, so I tried removing it and now I get this:

 Mono.Data.Tds.Protocol.TdsInternalException: Server closed the connection. ---> System.IO.IOException: Connection lost
   at Mono.Data.Tds.Protocol.TdsComm.GetPhysicalPacketHeader () [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.TdsComm.GetPhysicalPacket () [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.TdsComm.GetByte () [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.Tds.ProcessSubPacket () [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.Tds.NextResult () [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000] in <filename unknown>:0 
   --- End of inner exception stack trace ---
   at Mono.Data.Tds.Protocol.Tds.SkipToEnd () [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.Tds70.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x00000] in <filename unknown>:0 
   at Mono.Data.Tds.Protocol.Tds80.Connect (Mono.Data.Tds.Protocol.TdsConnectionParameters connectionParameters) [0x00000] in <filename unknown>:0 
   at System.Data.SqlClient.SqlConnection.Open () [0x00000] in <filename unknown>:0 
 UnityEngine.Debug:Log(Object)
 Comm:saveToDB(String) (at Assets/[TB] Script/General/Comm.cs:664)


I'm seriously clueless, I've rarely worked with databases and this is the first time I have to deal with Azure, no idea if and how it may differ from other SQL Server dbs... Any help will be highly appreciated!

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by zandalus · Dec 10, 2012 at 07:11 PM

Have you tried adding "Trusted_Connection=True;" to the connection string? I don't know Azure very well but I think it only accepts encrypted connections, not sure how you can implement SSL connections in Unity though.

Comment
Add comment · Show 1 · Share
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
avatar image kerebro · Dec 10, 2012 at 07:57 PM 0
Share

I tried that, nothing changed. I couldn't find anything about using SSL in Unity... Still lost.

avatar image
0

Answer by BobbyDoogle · Oct 03, 2014 at 03:17 PM

Has the writer of this thread figured it out in all this time, I would like to do the same thing, cross platform.

Comment
Add comment · Show 1 · Share
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
avatar image kerebro · Oct 03, 2014 at 04:05 PM 0
Share

Nope, sorry. We just switched to a WWWForm with POST data.

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

11 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

Related Questions

Mono.Data.Sqlite.dll set password error 0 Answers

SqliteKit encrypt incorrectly 1 Answer

How to integrate with Google Cloud mysql 0 Answers

Cloud recognition in Vuforia 0 Answers

Backend as a Service (BaaS) with RDBMS / SQL and Unity integration 1 Answer


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