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 Omwro · Sep 27, 2016 at 09:41 AM · errorconnectionsql

Connection Error with MS SQL 2014 and Unity3D

Dear Moderators, I made a game with a Login screen. to log in, you need to write the username and password which are stored in the database. one week ago it was working fine and didn't had any error, but i got all of a sudden an error and i dont know how i got this error because it did work 1 week ago. this is my error: ///////////////////////////////////////////////

SocketException: Er is een adres gebruikt dat niet compatibel is met het aangevraagde protocol.

System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP, Boolean requireSocketPolicy) System.Net.Sockets.Socket+Worker.Connect () Rethrow as TdsInternalException: Server does not exist or connection refused. Mono.Data.Tds.Protocol.TdsComm..ctor (System.String dataSource, Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) Mono.Data.Tds.Protocol.Tds..ctor (System.String dataSource, Int32 port, Int32 packetSize, Int32 timeout, TdsVersion tdsVersion) Mono.Data.Tds.Protocol.Tds70..ctor (System.String server, Int32 port, Int32 packetSize, Int32 timeout, TdsVersion version) Mono.Data.Tds.Protocol.Tds80..ctor (System.String server, Int32 port, Int32 packetSize, Int32 timeout) Mono.Data.Tds.Protocol.TdsConnectionPoolManager.CreateConnection (Mono.Data.Tds.Protocol.TdsConnectionInfo info) Mono.Data.Tds.Protocol.TdsConnectionPool.GetConnection () System.Data.SqlClient.SqlConnection.Open () Rethrow as SqlException: Server does not exist or connection refused. System.Data.SqlClient.SqlConnection.Open () (wrapper remoting-invoke-with-check) System.Data.SqlClient.SqlConnection:Open () Login.LoginButton () (at Assets/Script/Login.cs:49) UnityEngine.Events.InvokableCall.Invoke (System.Object[] args) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:153) UnityEngine.Events.InvokableCallList.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:630) UnityEngine.Events.UnityEventBase.Invoke (System.Object[] parameters) (at C:/buildslave/unity/build/Runtime/Export/UnityEvent.cs:765) UnityEngine.Events.UnityEvent.Invoke () (at C:/buildslave/unity/build/Runtime/Export/UnityEvent_0.cs:53) UnityEngine.UI.Button.Press () (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:35) UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/UI/Core/Button.cs:44) UnityEngine.EventSystems.ExecuteEvents.Execute (IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:52) UnityEngine.EventSystems.ExecuteEvents.Execute[IPointerClickHandler] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.EventFunction`1 functor) (at C:/buildslave/unity/build/Extensions/guisystem/UnityEngine.UI/EventSystem/ExecuteEvents.cs:269) UnityEngine.EventSystems.EventSystem:Update()

/////////////////////////////////////

when i click on the error it shows my Connection.Open(). ill post the script/code below:

 using UnityEngine;
 using UnityEngine.UI;
 using System.Collections;
 using System;
 using System.Text.RegularExpressions;
 using System.Data;
 using System.Data.SqlClient;
 using System.Data.Sql;
 
 public class Login : MonoBehaviour {
 
     public GameObject username;
     public GameObject password;
     public Text errormessage;
     public static string UN;
     private string PW;
     private string Form;
 
     void Start () {
         errormessage.text = "";
         username.GetComponent<InputField>().Select();
     }
     
     void Update () {
         UN = username.GetComponent<InputField>().text;
         PW = password.GetComponent<InputField>().text;
         if (UN != "")
         {
             if (Input.GetKeyDown(KeyCode.Tab))
             {
                 if (username.GetComponent<InputField>().isFocused)
                 {
                     password.GetComponent<InputField>().Select();
                 }
             }
             if (username.GetComponent<InputField>().text != "" &&
                 password.GetComponent<InputField>().text != "" &&
                 Input.GetKeyDown(KeyCode.Return))
             {
                 LoginButton();
             }
         }
     }
 
     public void LoginButton()
     {
         SqlConnection con = new SqlConnection(@"Data Source=(local);Initial Catalog='Roll A Ball';Integrated Security=True");
         bool login = false;
         con.Open();
         string sql = "SELECT * FROM Login WHERE Username='" + UN + "' and Password='" + PW + "'";
         SqlCommand cmd = new SqlCommand(sql, con);
         SqlDataReader dr = cmd.ExecuteReader();
         while (dr.Read())
         {
             login = true;
         }
         dr.Close();
         con.Close();
         if (login == true)
         {
             Application.LoadLevel(1);
         }
         else
         {
             errormessage.text = "Failed To Log In";
         }
     }
 }

i have searched a lot on Google, Unity and stackoverflow but with no success. i hope you guys can help me with this error

Comment
Add comment · Show 1
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 Omwro · Sep 28, 2016 at 09:02 AM 0
Share

Hey Everybody and $$anonymous$$oderators. i am not sure but i think i found the problem but not a solution. as far i see, the errormessage says that maybe the port is wrong. i did check the ports of the $$anonymous$$SSQL server and TCP/IP are enabled and are all at port 1433. as far i know is this correct but it still gives the same error. this was a bit more information. i hope you guys can still help me with finding a solution

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

68 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

Related Questions

SqlConnection Error con.Open() 0 Answers

uNet- A connection has already been set as ready. There can only be one. 3 Answers

SyncVars stop working after restarting Host 0 Answers

Can't connect from Unity 3.1 to SQL Server Express 8 Answers

Trouble with a build: CodePage 1250 not supported 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