Hi there! I'm using SQL Server 2008 as my database. When I run the game under Unity3D Project, everything works well, but if I build a .exe file under Windows 7 and run it outside, I cannot connect the SQL Server anymore. Anyone knows the solution? Do I miss some settings? Thanks!
1 Answer
1I worked it out finally! Since I'm using a Chinese version SQL Server 2008, I need a I18N.CJK.dll(China,Japan,Korea) besides I18N.West.dll and I18N.dll under Assets folder. It works well now.
I have already included I18N.CJK.dll I18N.West.dll and I18N.dll in my project and it work well after build as exe, but not work as web. I drive me crazy.
– SeneyHsns@seneyhsns: You are aware of the [security sandbox in which the webplayer][1] runs in? right? Almost all SQL connection libraries use a socket connection. Therefore, if you want to access an SQL server from a web build, you have to run a socket policy server along with your SQL server which explicitly allows the connection of a web player to the required port(s). You should get security exceptions when you try to do something like that without a crossdomain policy server. [1]: http://docs.unity3d.com/Manual/SecuritySandbox.html
– Bunny83
What does your connection string to the databse look like?
– MeltdownLike this: string connstr = "Server=XZZ-PC\\ProjectData;" + "Database=FJHHbattlefieldEnvironments;" + "User ID=sa;" + "Password=123456"; conn=new SqlConnection(connstr); conn.Open(); and it works well before building the exe
– anon60979874@rayjay214: Use comments if you don't post an answer. btw. according to <a href="http://answers.unity3d.com/users/4932/boxer.html">Li Lincheng's user page</a> he / she lives in china so i guess he / she is chinese ;)
– Bunny83