Link to home
Start Free TrialLog in
Avatar of JohnCoers
JohnCoers

asked on

Windows CE SQL Connectivity Problem

I have written a Windows CE app that works when connecting to one SQL Server, but does not work when connecting to the other.

This connection string works:

server=DYNAMICS;uid=xxxx;pwd=xxxx;database=SHF09

However, this connection string does not:

server=V1S1\SQLSERVER;uid=xxxx;pwd=xxxx;database=SHF09

Both are SQL Server 2005 databases and both servers are set to allow remote connections. Any ideas?


Avatar of alexey_gusev
alexey_gusev
Flag of United Kingdom of Great Britain and Northern Ireland image

the error code would be helpful :)
Avatar of JohnCoers
JohnCoers

ASKER

"Specified SQL server not found: DCS\DCS"

System.Data.SqlClient.SqlException was unhandled
  Class=20
  LineNumber=0
  Message="SqlException"
  Number=6
  Procedure="ConnectionOpen (Connect())."
  Server="DCS\DCS"
  Source=".Net SqlClient Data Provider"
  State=0
  StackTrace:
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParser.Connect(String host, SqlInternalConnection connHandler, Int32 timeout)
       at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
       at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, Hashtable connectionOptions)
       at System.Data.SqlClient.SqlConnection.Open()
       at VB_ScanSample1.ReaderForm.ReaderForm_Load(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.Run(Form fm)
       at VB_ScanSample1.ReaderForm.Main()
  InnerException:
does this server name ring any bells? it looks like wrong server name in the connection string, does it look correct under debugger? maybe you have there some characters escaped (like \S), although this doesn't seem possible from the error stack
Oops, I sent you the code after I tried to hit yet another SQL Server. The result is the same though. It returns the same error whether I'm trying for "V1S1\SQLSERVER" or "DCS\DCS".

ok, few things to try:

1) as mentioned eg here (http://www.connectionstrings.com/sql-server-2005) you can try DataSource instead of Server
2) http://msdn.microsoft.com/en-us/library/aa275613(SQL.80).aspx maybe helpful too
3) try IP address instead of server name, there was a bug in cf.net with DNS resolution
Based on those articles, I changed the connection string to:

Data Source=xxx.xxx.xxx.xxx;Initial Catalog=SHF09;Integrated Security=SSPI;User ID=xxx\xxxx;Password=xxxxx;

Which now gives me a new error:

"General network error. Check your network documentation."

System.Data.SqlClient.SqlException was unhandled
  Class=20
  LineNumber=0
  Message="SqlException"
  Number=11
  Procedure="ConnectionRead (recv())."
  Server="xxx.xxx.xxx.xxx"
  Source=".Net SqlClient Data Provider"
  State=0
  StackTrace:
       at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, TdsParserState state)
       at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, TdsParserState state)
       at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
       at System.Data.SqlClient.TdsParser.ReadNetlib(Int32 bytesExpected)
       at System.Data.SqlClient.TdsParser.ReadBuffer()
       at System.Data.SqlClient.TdsParser.ReadByte()
       at System.Data.SqlClient.TdsParser.Run(RunBehavior run, SqlCommand cmdHandler, SqlDataReader dataStream)
       at System.Data.SqlClient.TdsParser.Run(RunBehavior run)
       at System.Data.SqlClient.SqlInternalConnection.Login(Int32 timeout)
       at System.Data.SqlClient.SqlInternalConnection.OpenAndLogin()
       at System.Data.SqlClient.SqlInternalConnection..ctor(SqlConnection connection, Hashtable connectionOptions)
       at System.Data.SqlClient.SqlConnection.Open()
       at VB_ScanSample1.ReaderForm.ReaderForm_Load(Object sender, EventArgs e)
       at System.Windows.Forms.Form.OnLoad(EventArgs e)
       at System.Windows.Forms.Form._SetVisibleNotify(Boolean fVis)
       at System.Windows.Forms.Control.set_Visible(Boolean value)
       at System.Windows.Forms.Application.Run(Form fm)
       at VB_ScanSample1.ReaderForm.Main()
  InnerException:
Also, I'm certain that the IP address, User id and password are correct for the connection.

The part that I find interesting is that I CAN hit the SQL Server which does not designate it's computer name, "DYNAMICS". The other connections don't seem to work because the computer name is part of the SQL Server's name. Does that make sense?


ok, could you try to connect from iSql utility? it looks to me like some sort of network resolution issue, but I may be wrong
I've not used the ISql Utility before, but I can connect from the SQL Manager and all of my other .net programs can connect to any of the servers.

yes, but you need to check it from WinCE, not from desktop apps.
so iSql might give more info
Ok. I hate to seem totally clueless, but how do I fire up ISql in CE?

you need to install dev cab (if I'm not mistaken) which includes iSql utility, then run it on device
I've looked all over the place and cannot find the download for ISql onto the CE device.

do you have Sql Server installed? then you should have <some path>\vX.X\Devices\wce500\<processor>\*.dev*.cab
No, I never installed SQL on the CE device. I was hoping I would not need it.


no no, I mean on your desktop
Ah, ok. I'll dive into it. Thanks!
you ideally you should have cabs on your desktop, then you copy proper one to the device and install it, then run that utility and see what happens
At this point, I'm considering just moving my application to a server and letting the device RDP to the server. I think I would feel a little more comfortable from a stability standpoint. This quirky behavior is making me nervous.

if you can do it then that's fine.
just check that it can then connect with RDP :)
ASKER CERTIFIED SOLUTION
Avatar of JohnCoers
JohnCoers

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of hjgode
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.