Groups | Blog | Home
all groups > sql server msde > may 2005 >

sql server msde : moving EXE from MSDE PC to SQL Server PC


Andrea Montanari
5/24/2005 12:00:00 AM
hi Richard,
[quoted text, click to view]

try "(Local)" for local connections (without quotes)
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.12.0 - DbaMgr ver 0.58.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply

Richard Fagen
5/24/2005 5:46:26 PM
Hi,

I am developing a VB application on my PC using MSDE and have been using
Windows Trusted Connection and localhost

sqlConn = New
SqlConnection("server=localhost;trusted_connection=true;database=Pubs")

Then I copied the EXE to the PC running SQL server 2000 and I get an
error message

"SQL Server does not exist or access denied"

I suspect the I shouldn't use "localhost" and use the computer's name
but I am not sure how to code it so that it will work on my PC (call
Rick) and on the server (called Server)

Andrea Montanari
5/25/2005 12:00:00 AM
hi,
[quoted text, click to view]

I assume you are not under a domain, but just a p2p lan... and I assume no
network problems are present on the WinXPsp2 boxes as you already fixed
firewall troubles...
in your scenario, using a trusted remote connection does not belong to the
domain controller check but on standard netbios connections..
assuming you created on your wife's WinXPsp2 computer a YourWifePC\Rick
account you are not granted to use a trusted connection becouse of WinNT
credential check, but just becouse of a sort of "embezzlement", where the 2
different accounts, YourPC\Rick and YourWifePC\Rick, becomes confused in
this situation when a netbios connection between the 2 pcs has been already
established (remember, a preventive nebios connections, even using NET USE
... or a shared folder access is required)
more, you have to grant YourWifePC\Rick account login permission to
YourWifePC MSDE instance... (or make YourWifePC\Rick account member of a
WinNT group with login privileges)..

in your kind of scenario a standard SQL Server authenticated connection
(User Id=...;Password=...") is mor appropriate as you do not have a Domain
Controller to check identities and only sort of "workaround" grants you this
privilege..

on your customer's server, assuming he has a DC and not a workgroup, it
should run fine without additional mapping needs, as long as the used WinNT
account has individual login privileges or is member of a login granted
WinNT group (and please do no use Administrators overall :D)
so, depending on you app and on your customer needs and HD/SW requirements,
perhaps a standard SQL Server authenticated connections scenario could be
better.. even if trusted connections is preferred ....
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.12.0 - DbaMgr ver 0.58.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply

Richard Fagen
5/25/2005 12:00:00 AM
Hi Andrea,

[quoted text, click to view]

While this works from my PC (called Rick), it won't work from another PC
trying to access MSDE. I get the same message "SQL Server does not
exist or access denied".

While I guess I can use the try / catch / end try method to attempt to
connect to the server's name then if I get the error, try to connect to
the MSDE name, I was hoping for something simpler.

What type of connection strings do most people use?
Thanks

Richard




[quoted text, click to view]
Andrea Montanari
5/25/2005 12:00:00 AM
hi Richard,
[quoted text, click to view]

just a think... on the remote server, are you using a default instance or a
named instance? are the network protocols enabled on the remote server? is
there a firewall?
(Local) is the standard way to connect to local default instances, where
(Local)\InstanceName is ok for local named instances..
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org
DbaMgr2k ver 0.12.0 - DbaMgr ver 0.58.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply

Richard Fagen
5/25/2005 11:36:03 AM
Hi Andrea,

I am almost there. While I got it to work, I am not sure why certain
things happen.

I am testing with two XP SP2 computers. One is my development PC
(called RICK) with MSDE and Visual Studio, the other is my wife's PC.
I haven't tried named instances as I didn't even know about them when I
installed MSDE and I used the defaults. I have a third PC with XP
running SQL Server but I am leaving that one out for now until I get
this working.

If I code the VB.Net application with any of:
"server=localhost;trusted_connection=true;database=Pubs"
"server=(local);trusted_connection=true;database=Pubs"
"server=RICK;trusted_connection=true;database=Pubs"

it works perfectly from my PC, however, I can not run the application
from the other PC (from a shared folder on my PC) unless I use
"server=RICK..." line.

I even tried coding for the error, but this doesn't work.

Try
sqlConn = New SqlConnection("server=localhost; ....
Catch ex As Exception
MsgBox(Err.Number, , Err.Description)
sqlConn = New qlConnection("server=RICK; ...
End Try

It never gets to the catch part, it just gives the error message "SQL
Server does not exist or access denied"

I tried these but they all don't help:
- disabled XP firewall on both PC's
- login with same account that have Admin rights on both PC's

The only thing that works is if I connect with the explicit name
"server=RICK"

The problem is when I will move the application to my client, his SQL
Server isn't named 'Rick' :)

Any ideas?

Thanks for you help

Richard



[quoted text, click to view]
Richard Fagen
5/26/2005 1:18:25 PM
Hi Andrea,

Yes, at my place, I do not have a domain and I don't have any network
problems. Plus I can have my wife's PC use the EXE if I code it like
"server=RICK;trusted_connection=true;database=Pubs", everything is fine.

[quoted text, click to view]

If re-coded the application for my client (his server's name is SERVER)
so the code now reads

"server=SERVER;trusted_connection=true;database=Pubs"

it works at his site.

I also used the VB debugger to find out the problem, the "catch" part
never gets triggered. Even if I make up a string like

Try
sqlConn = New SqlConnection("server=NoSuchName; ....
Catch ex As Exception ' It never gets here?!
MsgBox(Err.Number, , Err.Description)
sqlConn = New qlConnection("server=SERVER; ...
End Try

Thanks for your great description about trusted connections. I did
create identical profiles (name and passwords, both admins) on both PCs
in my peer LAN.

I only have MSDE on ONE PC, mine. I thought that since my wife's PC can
access my MSDE (if I code it "server=RICK..." connection), then she
doesn't need MSDE.

[quoted text, click to view]

You are right, my customer has SBS 2000 which includes SQL 2000.
I tried connection strings of: "(local)", and "localhost" but the only
one that works is if I use "server=SERVER"

It isn't that big of a problem as I change one line of code, hit F5 to
recompile the new EXE and upload the file to my client. Then I change
it back and work on my PC.

I just don't understand why it won't work with any other connection
string, but at least it works :)

I also have it working on their server with regular (not admin) accounts :)

[quoted text, click to view]

Thanks for all your help!

Richard

AddThis Social Bookmark Button