admin管理员组文章数量:1291147
Error Message:
[InsertUserData] SQL Error Details: Code: 0, Message: A connection was successfully established with the server, but then an error occurred during the login process. (provider: TCP Provider, error: 0 - The operation completed successfully.
Problem:
I'm trying to connect my Unity project to a SQL Server 2005 instance on another PC. The SQL Server account (**
with password ****
) has full access and permissions (including db_owner
and read/write
). I can successfully ping the server’s IP address and port (e.g., 117.**.***.**
, port 50001
). Additionally, I can connect to the database from my laptop using SQL Server Management Studio. However, when I attempt to connect from Unity, I receive the error mentioned above during the login process.
Set up the SQL Server:
Install and configure SQL Server 2005 on a remote PC.
Create a database (
databasename
) and user (<username>
with password<password>
).
Setup in Unity:
Use the following connection string in my Unity project:
string connectionString = "Data Source=<censored IP>;Initial Catalog=photolocation;User Id=<username>;Password=<password>;Encrypt=False;TrustServerCertificate=True;Persist Security Info=True;";
Test Database Connection:
- When attempting to connect to the database from Unity (using the
InsertUserData
method), I encounter the error above.
- When attempting to connect to the database from Unity (using the
Expected Outcome:
- Unity should successfully connect to the SQL Server and insert data into the database.
Actual Outcome:
- The error message appears, and the connection does not complete.
Additional Information:
SQL Server 2005 is configured to accept SQL Server Authentication.
The account has the necessary permissions (
db_owner
,read/write
).I can ping the IP and connect via SQL Server Management Studio without issues.
The error only occurs within Unity and SQL server connection; it works fine in SSMS.
What I’ve Tried:
I've verified that SQL Server Authentication is enabled on the SQL Server instance.
I've ensured the correct IP and port are used in the connection string.
I've tested the connection via SQL Server Management Studio and it works fine.
I've made sure that firewall rules allow access on the necessary port.
本文标签: SQL Error Connection Establishedbut Login Fails in Unity with SQL Server 2005Stack Overflow
版权声明:本文标题:SQL Error: Connection Established, but Login Fails in Unity with SQL Server 2005 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741526378a2383491.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论