Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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

like image 363
Tarik Mokafih Avatar asked Jan 19 '26 16:01

Tarik Mokafih


1 Answers

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

like image 122
marc_s Avatar answered Jan 21 '26 05:01

marc_s