Database register method hangs
pr_kale
Posts: 5
I am trying to compare two databases on a remote server. Here is the code i am using (From sample). At the first Register method, the application just hangs. Any solutions?
I tried it by replacing server name with ".", meaning it works with local SQL server. But not with remote server.
*********************
Database db1=new Database();
Database db2=new Database();
db1.Register(new ConnectionProperties("CPSEPICUPG","c003"), Options.Default);
db2.Register(new ConnectionProperties("CPSEPICUPG","textDB71"), Options.Default);
Differences differences=db1.CompareWith(db2, Options.IgnorePermissions);
foreach (Difference difference in differences)
{
if ((difference.Type == DifferenceType.Different) || (difference.Type == DifferenceType.OnlyIn1))
{
Console.WriteLine("{0} {1} {2}", difference.Type.ToString(), difference.DatabaseObjectType.ToString(), difference.Name);
difference.Selected=false;
}
}
db1.Dispose();
db2.Dispose();
*********************
I tried it by replacing server name with ".", meaning it works with local SQL server. But not with remote server.
*********************
Database db1=new Database();
Database db2=new Database();
db1.Register(new ConnectionProperties("CPSEPICUPG","c003"), Options.Default);
db2.Register(new ConnectionProperties("CPSEPICUPG","textDB71"), Options.Default);
Differences differences=db1.CompareWith(db2, Options.IgnorePermissions);
foreach (Difference difference in differences)
{
if ((difference.Type == DifferenceType.Different) || (difference.Type == DifferenceType.OnlyIn1))
{
Console.WriteLine("{0} {1} {2}", difference.Type.ToString(), difference.DatabaseObjectType.ToString(), difference.Name);
difference.Selected=false;
}
}
db1.Dispose();
db2.Dispose();
*********************
Comments
The overloaded ConnectionProperties constructor that you have specified indicates that you want to connect to the server using Integrated Security. Is your Windows login allowed access to the database? This certainly would not work over the Internet and you may want to try specifying a SQL security user name and password.
You may also want to set one or more breakpoints in your code and run them under the debugger, then see how far your code gets.