Solved

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

Posted on 2004-10-14
9
503 Views
Last Modified: 2012-06-27
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
0
Comment
Question by:jxharding
9 Comments
 
LVL 39

Expert Comment

by:appari
ID: 12316719

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

Author Comment

by:jxharding
ID: 12316741
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
0
 

Author Comment

by:jxharding
ID: 12316902
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?
0
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 7

Expert Comment

by:sukumar_diya
ID: 12316917
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

0
 

Expert Comment

by:whittall
ID: 12317072
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
0
 
LVL 11

Expert Comment

by:rdrunner
ID: 12317128

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


0
 

Author Comment

by:jxharding
ID: 12317518
a lot of info , thanks, i'll be going through it now, and replying
0
 

Author Comment

by:jxharding
ID: 12317737
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!
0
 

Accepted Solution

by:
whittall earned 100 total points
ID: 12318130
Try server=PC1 (No Brackets)

Alan
0

Featured Post

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question