Can't open a connection to SQL Server 2005 from a pocketpc (windows mobile 6)

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-07 12:08:30

问题


I'm trying to connect from a pocket pc app (windows mobile 6) to a SQL Server 2005, but no matter how hard I try it didn't work. I checked every possible configuration for enabling tcp on SQL Server, I tested many connection strings, but still have the problem when I attempt to open the connection, I'm sure it's not a network issue because I can ping on my pocket pc from the server machine without any problem and the firewall on my server machine is disabled : here is one of the connection strings I used :

Data Source=10.168.0.160,1433;Initial Catalog=pos;Trusted_connection=yes;user id=myuserid;password=mypassword

where pos is the name of my database

Thank you for your help


回答1:


Well, you cannot have both a trusted connection and specify an explicit user name and password at the same time - it's either or.

EITHER you connect to your server with the trusted connection, e.g. your Windows credentials - then your connection string looks something like this:

Data Source=10.168.0.160,1433;Initial Catalog=pos;Integrated Security=SSPI;

OR alternatively, you use an explicit user name and password - but in that case, you CANNOT also use trusted connection / integrated security at the same time!

In this case, your connection string would be something like:

Data Source=10.168.0.160,1433;Initial Catalog=pos;user id=myuserid;password=mypassword

Check out the ConnectionStrings.com for loads of samples of valid connection strings for SQL Server




回答2:


You can't use Integrated Windows Authentication from a mobile device because the device doesn't have any concept of a logged in user. You also have to make sure the server has remote connections turned on.

Here's a simple example of how to get it working.



来源:https://stackoverflow.com/questions/7042484/cant-open-a-connection-to-sql-server-2005-from-a-pocketpc-windows-mobile-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!