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 = ",1433;" +
		"Database=db;" +
		"User ID=uid;" +
		"Pwd=pwd;" +
	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;
		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 
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!

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.

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