Link to home
Start Free TrialLog in
Avatar of jxharding
jxharding

asked on

how to connect pc1 to its own local server group,connect pc2 to pc1's server group, and use same connstring in app.config

hi, we have 2 pc's developing here.
each pc has sql server & client installed.
each pc's own sql server is called local to themselves.
we share source code so we have 1 app.config file. (source safe)

now i added another sql server group to my pc, pc2.
i called it MYSQL.

now i changed app.config from to
value="server=(local);Trusted_Connection=yes; database=xxxx; UiD=xx;Password=xxx;"/>
to
value="server=(MYSQL);Trusted_Connection=yes; database=xxxx; UiD=xx;Password=xxx;"/>

but it says it cant find the database and now neither of the pc's can connect.
(is the syntax perhaps wrong? i cant use IP address because they are automatically assigned)
what procedure should i follow in order for pc1 to connect to its own local server group.
and pc2 to connect to pc1's server group, and share the same connectionstring in app.config
Avatar of appari
appari
Flag of India image


try using the name of the other computer in place of (MySQL)
Avatar of jxharding
jxharding

ASKER

hi, i tried that , no go. i can see both server groups from my sql server enterprise manager, and mine is called local.
and the other pc's server group is actually the same as the pc name
is this the way that its supposed to be though , all connection strings incl pc with server, have the name of the pc with the server?
Hi,
Please check the authendication mode of the mysql sql server whether it is in Mixed Mode.
Check whether user has permission to acess the database and the objects in the database.
If you are connecting through TCP then Remove the TCP Protocol and save the settings and again add the TCP Protocol.


Try this.. Hope it may help you.

Thanks,
Suku

Hi,

Am I missing something.

Server groups in enterprise manager are only a means of organising enterprise managers display of them. You can not connect to these groups, you can only connect to servers.

You can connect to a local database using the machine name instead of (local), so try changing connection string to pc2, both machines should now use the sql server installed on pc2.

Have fun
alan

Also if you are using trusted connections, then you dont need this  "UiD=xx;Password=xxx;" in your connection string. You will authenticate yourself as the User running the software or the User thats impersonated by your website. Make sure they both have access to the SQL Server.

To connect to the server you show first try to figure out if the PC names are resolved properly. To do this you just need to ping the computer where the database is located.

Ping pc1

This should resolve the PC name and return 4 lines with a timing. If you get "not reachable" you dont have a working DNS. But since you said you get the IP automatically this should not be the case.

To figure out the name of the computer running the SQL Server you can goto the SQL Server rightclick on "My Computer" goto Properties and select the "Computername" Tab. You PC name should be listed there.

Just enter this as the Computername.

If it still fails, do a Profiler trace vs your SQL Server and try to watch the logins and see which ones fail.

Hope this helps


a lot of info , thanks, i'll be going through it now, and replying
pc2 cannot connect to pc1 if
value="server=(PC1);Trusted_Connection=yes; database=xxxx; UiD=xx;Password=xxx;"/>

now i tried
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ConnectionString"
value="data source=PC2; database=xxx; UiD=xx;Password=xx;"/>
</appSettings>
</configuration>

this works!
comments please!
ASKER CERTIFIED SOLUTION
Avatar of whittall
whittall

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